Won't send an e-mail

Asked by At

So I'm using PHPAutoload to send an e-mail. However the mail won't send. I made a contact form where I ask for your name, subject and message and implemented that into my php code. Can anybody help me?

Thanks in advance.

require 'PHPMailerAutoload.php';
$mail->Username='[email protected]';

$mail->setFrom($_POST['email'], $_POST['name']);
$mail->addReplyTo($_POST['email'], $_POST['name']);
$mail->Subject='Test ';

1 Answers

Danyal Sandeelo On Best Solutions

You forgot to call send() so add this code after $mail->Body='Test';

if (!$mail->send()) {
    echo 'Mailer Error: ' . $mail->ErrorInfo; // you can redirect to an error page
} else {
    echo 'Message sent!'; // you can redirect to a thank page