1

I am using wamp server and PHPMailer to send a test email. Here is my code:

<?php
require_once ("includes/PHPMailer/class.phpmailer.php");
require_once ("includes/PHPMailer/class.smtp.php");
require_once ("includes/PHPMailer/language/phpmailer-lang-en.php");

$to_name = "Junk mail";
$to = "myemail@yahoo.com";
$subject = "Mail Test at" .strftime("%T", time());
$message = "This is a test.";
$message = wordwrap($message, 70);
$from_name = "My Name";
$from = "myemail@gmail.com";

//PHP mail version (default)
$mail = new PHPMailer();
try {
    $mail->FromName = $from_name;
    $mail->From = $from;
    $mail->AddAddress($to, $to_name);
    $mail->Subject = $subject;
    $mail->Body = $message;
    $mail->SMTPDebug = 1;
    $result = $mail->Send();
    echo 'Sent';
} catch (phpmailerException $e) {
    echo $e->errorMessage();
}
?>

I am getting Sent as a result (no errors), but in my yahoo account I did not receive anything.

tshepang
  • 12,111
  • 21
  • 91
  • 136
JIT Develop
  • 128
  • 1
  • 10

0 Answers0