Jump to content

Getting a error when sending emails from website webform


racealoot

Recommended Posts

Warning: require_once(Mmail.class.php) [function.require-once]: failed to open stream: No such file or directory in C:\Inetpub\vhosts\CWS.secureserver.net\site3\contactform.php on line 6

Fatal error: require_once() [function.require]: Failed opening required 'Mmail.class.php' (include_path='.;./includes;./pear') in C:\Inetpub\vhosts\CWS.secureserver.net\site3\contactform.php on line 6

 

This is the complete code that i am using:

 

<?php 

    ini_set("upload_max_filesize", "25M");
    ini_set("post_max_size", "25M");
    ini_set("max_execution_time", "600");
    set_time_limit(0);
require_once('Mmail.class.php');
 
//echo "<pre>";print_r($_REQUEST);print_r($_FILES);exit;
/* Gathering Data Variables */
$errFlag = 0;
$errFlag1 = 0;
$errArray = array();
if(isset($_REQUEST['email']))
{
            $cnt = sizeof($_FILES['att']['name']);
            if($cnt)
            {
                    for($i=0;$i<$cnt;$i++)
                    {
                        if($_FILES['attr']['name'][$i] == '')
                            continue;
                        
                            $filename = $_FILES['attr']['name'];
                            $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
                            $allowedExt = array('jpg','png','jpeg','gif','rtf','doc','docx','pdf','xls','csv');
                            if(!in_array($ext, $allowedExt))
                                    $errArray[]= $_FILES['attr']['name'][$i]." format is not allowed";
                            if($_FILES['attr']['size'][$i] > 25*1024*1024)
                                $errArray[] = $_FILES['attr']['name'][$i]." file size exceeded to max. limit 25MB";
                    }
            }
            
            if(empty($errArray))
            {
 
$emailField = (isset($_REQUEST['email']) && !empty($_POST['email']))?$_POST['email']:'';
$nameField = (isset($_REQUEST['name']) && !empty($_POST['name']))?$_POST['name']:'';
$phoneField = (isset($_REQUEST['phone']) && !empty($_POST['phone']))?$_POST['phone']:'';
$addressField = (isset($_REQUEST['address']) && !empty($_POST['address']))?$_POST['address']:'';
$crossField = (isset($_REQUEST['cross']) && !empty($_POST['cross']))?$_POST['cross']:'';
$question1Field = (isset($_REQUEST['question1']) && !empty($_POST['question1']))?$_POST['question1']:'';
$question2Field = (isset($_REQUEST['question2']) && !empty($_POST['question2']))?$_POST['question2']:'';
$question3Field = (isset($_REQUEST['question3']) && !empty($_POST['question3']))?$_POST['question3']:'';
$question4Field = (isset($_REQUEST['question4']) && !empty($_POST['question4']))?$_POST['question4']:'';
$question5Field = (isset($_REQUEST['question5']) && !empty($_POST['question5']))?$_POST['question5']:'';
$question6Field = (isset($_REQUEST['question6']) && !empty($_POST['question6']))?$_POST['question6']:'';
$question7Field = (isset($_REQUEST['question7']) && !empty($_POST['question7']))?$_POST['question7']:'';
$question8Field = (isset($_REQUEST['question8']) && !empty($_POST['question8']))?$_POST['question8']:'';
$question9Field = (isset($_REQUEST['question9']) && !empty($_POST['question9']))?$_POST['question9']:'';
$question10Field = (isset($_REQUEST['question10']) && !empty($_POST['question10']))?$_POST['question10']:'';
$question11Field = (isset($_REQUEST['question11']) && !empty($_POST['question11']))?$_POST['question11']:'';
 
$appdateField = (isset($_REQUEST['appdate']) && !empty($_POST['appdate']))?$_POST['appdate']:'';
$apptimeField = (isset($_REQUEST['apptime']) && !empty($_POST['apptime']))?$_POST['apptime']:'';
$commentsField = (isset($_REQUEST['comments']) && !empty($_POST['comments']))?$_POST['comments']:'';
 
$From = $emailField;
 
$Subject='New Consultation Request';
 
$CRLF='<br>';
$Body ="
<p style='font-family:verdana, Helvetica, sans-serif; font-size:13px; font-weight:bold; color:#094a72; text-decoration:none;'>
Dear Admin,{$CRLF}
 
You have received a consultation request Form from {$nameField} with the following detail : {$CRLF}
*****************************************{$CRLF}
Name : {$nameField}{$CRLF}
Email : {$emailField}{$CRLF}
Phone : {$phoneField}{$CRLF}";
$Body .=" Address : {$addressField}{$CRLF}";
$Body .=" Nearest Cross Street : {$crossField}{$CRLF}";
$Body .=" What is the most convenient time to contact you? : {$question1Field}{$CRLF}";
$Body .=" Are you interested in a Custom 3D Landscape Design? : {$question2Field}{$CRLF}";
$Body .=" Are you looking to Re-Model your existing Landscape? : {$question3Field}{$CRLF}";
$Body .=" Have you had any Professional Landscaping done in the Past? If yes, Who? : {$question4Field}{$CRLF}";
$Body .=" How long do you plan on living in your Existing home? : {$question5Field}{$CRLF}";
$Body .=" Would you consider your yard to be a Large, Medium or Small Yard? : {$question6Field}{$CRLF}";
$Body .=" Approximately how many Sq. Ft.? : {$question7Field}{$CRLF}";
$Body .=" When would you like this Project to be completed? : {$question8Field}{$CRLF}";
$Body .=" Would you consider Price, Quality or Design to be MOST Important to you? : {$question9Field}{$CRLF}";
$Body .=" What is your Approximate Budget for all Landscaping? : {$question10Field}{$CRLF}";
$Body .=" Please describe the work you desire to be done? Concrete? Waterfall? Irrigation? : {$question11Field}{$CRLF}
*****************************************{$CRLF}{$CRLF}";
if(!empty($appdateField)) {
$Body .=" Appointment Date : {$appdateField}{$CRLF}";
}
 
if(!empty($apptimeField)) {
$Body .=" Appointment Time : {$apptimeField}{$CRLF}";
}
 
if(!empty($commentsField)) {
$Body .=" Comments : ".nl2br($commentsField)."{$CRLF}";
}
$Body .="*****************************************{$CRLF}
Regards,{$CRLF}{$CRLF}
3D Scapes
</p> ";
 
$mail = new Mmail();
 
$mail->setSubject($Subject);
                
$mail->To[] = $to;
$mail->From = $From;
$mail->setHtmlBody($Body);
 
if($cnt)
{
for($i=0;$i<$cnt;$i++) 
{
if($_FILES['att']['error'][$i] == 0 && $_FILES['att']['tmp_name'][$i] != '')
{
$mail->addAttachment($_FILES['att']['name'][$i],$_FILES['att']['type'][$i], $_FILES['att']['tmp_name'][$i]);
}
}
}
//echo "<pre>";print_r($_REQUEST);print_r($_FILES);exit;
$mail->send();
            }
            else
                $errFlag = 1;
}
else
$errFlag = 1;
?>
<html>
<head>
<title>Thank You</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #f1f1f1;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
}
-->
</style>
</head>
<body>
<div>
 <div align="left">
  <?php 
if($errFlag == 0) {
echo "Thank you for your interest in 3D scapes! Your email has been sent and you will recieve a reply very soon!";
                                        echo '<br /><a href="index.html">Click Here</a> to go Home page.';
}
                                else 
                                 {
                                    echo implode("<br />", $errArray);
                                    echo '<br /><a href="contact.html">Click Here</a> to go to Contact page to resubmit your form.';
}
?>
</div>
</div>
</body>
</html>

Please, in the future use [ code ] tags when providing code on the forum. It formats it nicely so it is easy to read.

 

To answer your question open up your code editor and take a look is there a file, named Mmail.class.php inside C:\Inetpub\vhosts\CWS.secureserver.net\site3\ directory.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.