When I put sender email address other than yahoo id, mail sent and deliver. It also works for yahoo receivers. In script it when I use Gmail as a sender, Yahoo receives but not the vice versa i.e Yahoo sender does not deliver in Gmail.
Is this a server problem or error in my code?
Here is my code
$mail = new PHPMailer();
$mail->isMail(true);
$mail->IsHTML(true);
$mail->AddEmbeddedImage('img/logo.png', 'logo');
$mail->AddEmbeddedImage('img/plunder_icon.png', 'icon');
$to = 'nabina.smartmobe@gmail.com'; // receiver email
$mail->AddAddress($to);
$from = 'nvn_shahi@yahoo.com';
$user_name = 'Nabina';
$mail->SetFrom($from,$user_name);
$mail->AddReplyTo($from,$user_name);
$subject = 'Hi';
$msg = 'test';
$mail->Subject = $subject;
$msg = get_mail_format($msg);
$mail->Body = $msg;
try{
if($mail->Send()){
return true;
}else{
return false;
}
} catch(Exception $e){
//Something went bad
echo "Fail - " . $mail->ErrorInfo; die;
}
Continuing my answer, as PHPMailer says, check the following example and add it to your code:
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'user@example.com'; // SMTP username
$mail->Password = 'secret'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted