i am using PHPmailer to send emails
here is code that i have used:
$mail = new PHPMailer();
$subject = "test";
$to = "test_patel@yahoo.com"
$mail->SetFrom("PDSociety@aol.com","Punjab Dental Society");
$mail->AddReplyTo("PDSociety@aol.com", "Punjab Dental Society");
$mail->Subject = $subject;
$mail->MsgHTML($str);
$mail->AddAddress($to, "Punjab Dental Society");
if(!$mail->Send())
{
$err = "Mailer Error: " . $mail->ErrorInfo;
//echo $err;
} else {
$msg = "Message sent!";
}
// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
if i change email address from yahoo to gmail or hotmail, still email are not sent.
i checked by echoing error, but no errors.
can anyone explain what is the issue ?
PHPMailer is only involved in submitting the message to your own mail server, and you're not having any problem there. After that, your mail server takes on the responsibility of sending it on, so you will find the answer in your mail server's logs.
There is no simple way to ensure messages end up in the inbox and not spam - if there was, spammers would be using it and filtering would be useless. Make sure your DNS resolves backwards and forwards, that you have valid SPF records, that you sign your messages with DKIM (especially important for Yahoo) and most importantly, that you don't send messages that your recipients think are spam.
Try this :
It will help you if any exception error.
Have you looked on the post here: Using PHPMailer Results in many blocked emails? The asker solved the issue by changing the email subject:
The content of the email and its subject can make ISPs ban it. You could try taking the content of one of your received emails from your inbox and see if that goes through.
After trying various ways, i found following code working with almost all email providers
variable values needs to be changed accordingly. Hope these helps people having issues with PHPmailer