Hi, my problem still hasn't been resolved - here is the code for the sendmail-multi.php file that the form is running from if you are able to help me - thanks:
<?php
require_once('phpmailer/PHPMailerAutoload.php');
$toemails = array();
$toemails[] = array(
'email' => 'xxxxx', // Your Email Address
'name' => 'xxxxx' // Your Name
);
// Form Processing Messages
$message_success = 'We have successfully received your brief and it will now be processed. Thank you.';
// Add this only if you use reCaptcha with your Contact Forms
$recaptcha_secret = ''; // Your reCaptcha Secret
$mail = new PHPMailer();
// If you intend you use SMTP, add your SMTP Code after this Line
$mail->IsSMTP();
$mail->Host = "smtp.live.com";
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->Port = 25;
$mail->Username = "xxxxx";
$mail->Password = "xxxxx";
if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
if( $_POST['contactform-requestedby'] != '' ) {
$jobnumber = isset( $_POST['template-contactform-jobnumber'] ) ? $_POST['template-contactform-jobnumber'] : '';
$client = isset( $_POST['template-contactform-client'] ) ? $_POST['template-contactform-client'] : '';
$requestedby = isset( $_POST['template-contactform-requestedby'] ) ? $_POST['template-contactform-requestedby'] : '';
$projecttitle = isset( $_POST['template-contactform-projecttitle'] ) ? $_POST['template-contactform-projecttitle'] : '';
$projecttype = isset( $_POST['template-contactform-projecttype'] ) ? $_POST['template-contactform-projecttype'] : '';
$subject = isset($subject) ? $subject : 'New Message From Contact Form';
$botcheck = $_POST['template-contactform-botcheck'];
if( $botcheck == '' ) {
$mail->SetFrom( $email , $name );
$mail->AddReplyTo( $email , $name );
foreach( $toemails as $toemail ) {
$mail->AddAddress( $toemail['email'] , $toemail['name'] );
}
$mail->Subject = $subject;
$name = isset($name) ? "Name: $name<br><br>" : '';
$email = isset($email) ? "Email: $email<br><br>" : '';
$phone = isset($phone) ? "Phone: $phone<br><br>" : '';
$service = isset($service) ? "Service: " . ( is_array($service) ? implode( ', ', $service ) : $service ) . "<br><br>" : '';
$message = isset($message) ? "Message: $message<br><br>" : '';
$referrer = $_SERVER['HTTP_REFERER'] ? '<br><br><br>This Form was submitted from: ' . $_SERVER['HTTP_REFERER'] : '';
$body = " $jobnumber $client $requestedby $projecttitle $projecttype ";
if( isset( $_FILES['template-contactform-file'] ) AND is_array( $_FILES['template-contactform-file'] ) ) {
$countfiles = count( $_FILES['template-contactform-file'] );
for( $i=0; $i < $countfiles; $i++ ) {
if ( isset( $_FILES['template-contactform-file']['tmp_name'][$i] ) ) {
$mail->IsHTML(true);
$mail->AddAttachment( $_FILES['template-contactform-file']['tmp_name'][$i], $_FILES['template-contactform-file']['name'][$i] );
}
}
}
// Runs only when reCaptcha is present in the Contact Form
if( isset( $_POST['g-recaptcha-response'] ) ) {
$recaptcha_response = $_POST['g-recaptcha-response'];
$response = file_get_contents( "https://www.google.com/recaptcha/api/siteverify?secret=" . $recaptcha_secret . "&response=" . $recaptcha_response );
$g_response = json_decode( $response );
if ( $g_response->success !== true ) {
echo '{ "alert": "error", "message": "Captcha not Validated! Please Try Again." }';
die;
}
}
$mail->MsgHTML( $body );
$sendEmail = $mail->Send();
if( $sendEmail == true ):
echo '{ "alert": "success", "message": "' . $message_success . '" }';
else:
echo '{ "alert": "error", "message": "Email **could not** be sent due to some Unexpected Error. Please Try Again later.<br /><br />**Reason:**<br />' . $mail->ErrorInfo . '" }';
endif;
} else {
echo '{ "alert": "error", "message": "Bot **Detected**.! Clean yourself Botster.!" }';
}
} else {
echo '{ "alert": "error", "message": "Please **Fill up** all the Fields and Try Again." }';
}
} else {
echo '{ "alert": "error", "message": "An unexpected error occured. Please Try Again later." }';
}
?>