I am using the php mail code to send emails from a website very successfully. However when the email address to send to is in the format xxx.yyy@zzz.com it won't send. Any ideas?

I am able later to post any code samples needed if necessary but all seems to be working well except in those particular circumstances.

Recommended Answers

All 10 Replies

Member Avatar for nileshgr

Weird problem, could you please share your code ?

Thanks for responding to my post.

Here is the code below. I have removed some of the identifying info from the email. The $to email address and the orderID are supplied by a MySQL data query. If the $to email address or any of the other email addresses CC or BCC are in the format xxx.yy@zzz.com then that address is not delivered to. The other addresses are delivered to. So the mail is not failing, just those addresses are.

I hope this is enough for you to consider if not please let me know.

$to = $row_rsUserReturn['Email'];
$subject = "Quotation Number ".$row_rsUserReturn['OrderID'] ." from My Company";
$message = "Dear"." ". $row_rsUserReturn['Name']."\n
Thank you for requesting a quote from Buy Sun Online .\n
A member of our sales team will contact you shortly.\n
If you have any queries please quote the following reference number"." ".$row_rsUserReturn['OrderID']."\n
Kind regards\n
My Company Limited ";
$from = "me@mycompany.com";
$headers = "From: $from\r\n";
$headers.= "CC: sales@mycompany.com>\r\n";
$headers.= "BCC: info@mycompany.com\r\n";
mail($to,$subject,$message,$headers);
Member Avatar for nileshgr

I don't see anything wrong in this. You try to send a mail to one such id directly i.e. without using info from the db. Use some dummy mail id.

I have tried hard coding the email addresses in rather than using the db. All send that are in the format xxx@zzz.com but the one to xxx.yyy@zzz.com fails. I can receive mail via that address sent via Outlook etc. so I know the address works.

I have remove the database query from the page in case there was a conflict, unlikely I know, so that I only have the mail () code. Works as above. I wonder if there could be anything within PHP that blocks these emails...

Have Googled extensively but can't find anything. I do have access to a Windows box so will test the code there. My server is a Linux box. Will report back on any success or otherwise.

Thanks for looking in!

Member Avatar for nileshgr

Well, this seems to be an issue with the mail server. Its nothing to do with PHP or the DB server you're using.

Member Avatar for rajarajan2017
xxx.yyy@zzz.com

Just test this id in you personal mail server without the code to confirm really an id exists.

The example is only to illustrate the email format. Basically if there is a . in the local part of the address the mail fails to be sent. Other addresses are sent to. I have tested all addresses and they are all valid.

This is a strange one, I think it must be something to do with the server.

Member Avatar for nileshgr

@mark, surely it is; that's what I feel. There's nothing wrong in your code.

Thanks itech, I'll post something one one of the other boards and see if anyone has an idea.

yeah i totaly agree... there's no problem with your code on sending mail. i suspect the problem is in the mail server.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.