Jump to content

PHP mail() function - users not receiving mail


php_guy

Recommended Posts

Hi all,

 

I'm coding an automated mailer for a dentist office. They set appointment dates through a web interface, and then this appointment is mailed to the customer via PHP's mail() function.

 

However, some users are not receving the mail. They claim that it is not even in the junk mail folder. Is it because I'm setting or not setting certain properties in the header? Should I be setting something else?

 

Here is my code

ini_set("SMTP", "mail.isp-provider.net");
	$headers = 'From: Schedule Manager <schedule@address.com>' . "\r\n" .
		'Reply-To: Schedule Manager <schedule@address.com>' . "\r\n" .
		'Bcc: internal@address.com' . "\r\n" .
		'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
		'X-Mailer: PHP/' . phpversion();

	mail($customerAddress, $subject, $body, $headers);

Note that customerAddress, subject, and body are all just regular normal strings.

 

As I said, it works for most customers, but some customers do not receive the emails.

Link to comment
Share on other sites

php mail() function is not a perfect thing to use. Many a times, google/yahoo or some other email providers block the addresses of your hosting, as a result the mail never reached in the destination (so, not in the junk box also). Sometimes, you might face that you sent to two email addresses in different domain (say, gmail and hotmail), one got delivered, other not. So mail() function, though is very simple and easy to use, not suitable always if you want reliable email delivery.

 

To me, best thing is to use smtp server of your hosting or any gmail address if your hosting support FSOCKOPEN.

Link to comment
Share on other sites

Hi abdbuet,

 

Not quite sure what you meant by the following

...some other email providers block the addresses of your hosting...

could you please elaborate?

 

You mentioned a good solution would be to use the smtp server of my host... I'm supplying the SMTP of their ISP. Wouldn't this be reliable enough?

 

Thanks

Link to comment
Share on other sites

okay, what I faced at early days was, whenever I used mail() function, my emails never delivered to the yahoo addresses, but had no problem with hotmail. The main reason is, sometimes those email providers can drop all the mails from some certain domain if extensive spamming occurs from that area. Because as you know, anyone can misuse mail() function to spam mailbox of people.

 

What I can suggest to us google smtp, which I feel most reliable. Just have a gmail account, enable POP/IMAP from account settings and then use some built-in classes like http://phpmailer.worxware.com/index.php?pg=sf&p=dl. And if you want email address like you@yourdomain.com, you can even havethat using Google App ... this is totally independent whether you get SMTP from your host.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.