estoy empezando a usar la documentación de PHPMailer
pero no se como enlazarla a mi correo, acabo de descargar la versión mas reciente de PHPmailer
y mi versión de PHP
en mi ÌISes la 5.6.31, mi código de
PHP` es el siguiente.
<?php
require_once('phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
if( isset( $_POST['template-contactform-submit'] ) AND $_POST['template-contactform-submit'] == 'submit' ) {
if( $_POST['template-contactform-name'] != '' AND $_POST['template-contactform-email'] != '' AND $_POST['template-contactform-message'] != '' ) {
$name = $_POST['template-contactform-name'];
$email = $_POST['template-contactform-email'];
$phone = $_POST['template-contactform-phone'];
$service = $_POST['template-contactform-service'];
$subject = $_POST['template-contactform-subject'];
$message = $_POST['template-contactform-message'];
$subject = isset($subject) ? $subject : 'New Message From Contact Form';
$botcheck = $_POST['template-contactform-botcheck'];
$toemail = '[email protected]'; // Your Email Address
$toname = 'Polo Moreno'; // Your Name
if( $botcheck == '' ) {
$mail->SetFrom( $email , $name );
$mail->AddReplyTo( $email , $name );
$mail->AddAddress( $toemail , $toname );
$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: $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 = "$name $email $phone $service $message $referrer";
$mail->MsgHTML( $body );
$sendEmail = $mail->Send();
if( $sendEmail == true ):
echo 'We have <strong>successfully</strong> received your Message and will get Back to you as soon as possible.';
else:
echo 'Email <strong>could not</strong> be sent due to some Unexpected Error. Please Try Again later.<br /><br /><strong>Reason:</strong><br />' . $mail->ErrorInfo . '';
endif;
} else {
echo 'Bot <strong>Detected</strong>.! Clean yourself Botster.!';
}
} else {
echo 'Please <strong>Fill up</strong> all the Fields and Try Again.';
}
} else {
echo 'An <strong>unexpected error</strong> occured. Please Try Again later.';
}
?>
Que es lo que esta mal con mi ¿código? ya que no quiere ejecutar el enviar el mensaje a mi correo.