Danilo Escapa
Danilo Escapa

Reputation: 151

Message sent but doesnt receive by email address in PHPMailer?

Im using PHPmailer 5.4.2 and try one of its given example. It gives me true result which is "Message Sent" but the email address I have states in the code doesnt receive anything. Here is the code.

<html>
<head>
<title>PHPMailer - Mail() basic test</title>
</head>
<body>

<?php

require_once('../class.phpmailer.php');

$mail             = new PHPMailer(); // defaults to using php "mail()"

$body             = "fhgdshfgjsd";

$mail->SetFrom('[email protected]', 'Verbo Angelo Ludovice');

$mail->AddReplyTo("[email protected]","Verbo Angelo Ludovice");

$address = "[email protected]";
$mail->AddAddress($address, "John Doe");

$mail->Subject    = "PHPMailer Test Subject via mail(), basic";

$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->MsgHTML($body);

$mail->AddAttachment("images/phpmailer.gif");      // attachment
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment

if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

?>

</body>
</html>

Upvotes: 0

Views: 810

Answers (1)

adeam
adeam

Reputation: 73

That's because you are trying to send email from your server via gmail without any authentification, therefore yahoo treats it as a forged/spam email. You will need to either:
- don't use **@gmail.com as a from address
- or forward your mail thru gmail smtp server (you will need to provide credentials), you can find all settings in your gmail\settings\pop3, imap tab

Upvotes: 1

Related Questions