1

I am using a PHP script to send e-mails to a list of friends. This used to work successfully but now the only e-mails that are sent successfully are those inside my domain ("mycompany.com"). Any e-mails outside my domain fail to be sent. Is this a problem with permissions? Could I fix it by changing the headers I use when I call the mail() function? Here is the PHP script:

$name = "Joe Smith";
$email = "jsmith@mycompany.com";
$to = "ajones@mycompany.com, tom@abc.com, ted@def.com, mary@ghi.com";
$subject = "Dinner Invitations";
$message = "Invitation to Dinner";
$headers  = "From: ".$name."<".$email.">\r\n";
$headers .= "Reply-To: ".$email."\r\n";
$headers .= "Return-Path: ".$email."\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
$headers .= 'Content-Transfer-Encoding: quoted-printable' . "\r\n";
mail($to, $subject, $message, $headers);

Only ajones@mycompany.com was sent out by the server. tom@abc.com, ted@def.com, and mary@ghi.com did not get sent.

Any suggestions would be deeply appreciated!

CurtisD
  • 163
  • 1
  • 9
  • 3
    did you check the spam folder? they must be there – Danyal Sandeelo Aug 17 '15 at 09:04
  • I don't have access to the spam folder. And I don't have access to a log of errors. I am hoping for suggestions so I can pass them on to the server admin. – CurtisD Aug 17 '15 at 09:06
  • 3
    You are a little short on details, as any one of a hundered things could have changed in the downline processing that is involved in sending mail, not least being the mail admin blocking mail to unknown address's – RiggsFolly Aug 17 '15 at 09:07
  • 1
    This may be blocked either in the client, your server, or any of the relay servers inbetween. A server can be configured to 'allow' sending mails for a specific domain. The receiver of a mail may check this by sending a verification to the domain. Anyway, without proper access to at least the spam folder and the PHP/Apache error logs, and without checking the result of the `mail` function, you're basically blindfolded. – GolezTrol Aug 17 '15 at 09:07
  • if email is received on one id, rest of them must receive the email as well.. – Danyal Sandeelo Aug 17 '15 at 09:08
  • Can you send mail to these other addresses using the companies standard mailing client? – RiggsFolly Aug 17 '15 at 09:08
  • This really could be anything. Let somebody check your server's mail log. It should give you hints as to why your mails fail to be delivered. Maybe your server caught some malware and started to send spam, so other servers stopped trusting your server? – tarleb Aug 17 '15 at 09:11
  • I was told by the server admin that some "maintenance" was done on the server, but he didn't think it would affect sending e-mail. All I know is the server is not sending e-mails to anyone outside my domain. I was hoping there might be a header variable that would allow me to request permission to send e-mails outside my domain. – CurtisD Aug 17 '15 at 09:11
  • I think you need to connect to a valid mail server via SMTP to send mail. Almost receiver's server blocking mail from unknown address (which was configured in your php.ini). More detail on sending SMTP mail is here: http://stackoverflow.com/questions/3525818/smtp-configuration-for-php-mail – Darian Aug 17 '15 at 09:13
  • I will ask the admin to check the error logs. He's pretty busy and I was hoping to offer suggestions that would speed up his investigation of the problem. – CurtisD Aug 17 '15 at 09:14

0 Answers0