Avatar of synergiq
synergiq
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

PHPMailer only sending out emails to some addresses

My site sends out automated emails (such as a 'reset your password' email when a user forgets their password). Everything was working fine but I switched across to a new server which uses Plesk instead of cPanel (like my old one).

I set up all the email accounts that send out emails again but now only some of the emails work. My work email, gmail and hotmail are all fine but if I try to send an email to my friends email it cant send it.

I have noticed that my friends domain (the one he uses for the email) is registered with 1and1 which is the same company I have my server through, could the fact that the domain the email is being sent from and to have the same nameservers stop the email being sent?

I have checked my sendmail path which is:
/usr/sbin/sendmail -t -i and the one in my phpmailer is /usr/sbin/sendmail
I'm not sure what the -t -i means but I assume they're the same?

The SMTP path in my phpinfo is localhost so should I be setting my phpmailer host as localhost or smtp.mydomain.com?

Also my settings for sending my mail are:
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "localhost"; // SMTP server
$mail->SMTPAuth = true;    
$mail->Username = "forgot@mydomain.com";
$mail->Password = "PaSsWoRd";
$mail->From = "forgot@mydomain.com";
$mail->FromName = "Password Reset";
$mail->AddAddress($EmailAddr);
$mail->IsHTML(true);    
$mail->Subject = "Password Reset";

Is all of this correct for using phpmailer on Plesk with qMail?;
Email ProtocolsPHP

Avatar of undefined
Last Comment
synergiq

8/22/2022 - Mon