Jump to content

Confirm PHP mail sent from server


phppup

Recommended Posts

I've used PHP's mail function previously and I'm thinking of using it again.

At one point, I recall getting success messages when the mail function completed, but discovered that certain emails were never received by recipients.

After much troubleshooting, I discovered that the shared hosting server that I was using included quota limits on outboard emails.

Essentially (if my understanding is correct), the PHP confirmation was accurate, but the actual messages (after hitting the quota) were never dispatched.

How can I get confirmation that the intended email actually left the server?

Further, can I determine that it wasn't filtered by the recipient's email provider or tagged as spam?

Edited by phppup
Forgot item
Link to comment
Share on other sites

I wouldn't use php's native mail function to be honest. PHPMailer is easier, more robust, and more reliable as both requinix and ginerjm have pointed out. That having been said, if your project requires mail stats you may be better off looking into a service. MailChimp has an API that doesn't completely suck and ConstantContact has an API - both of them have methods in place to gather interaction stats, though honestly even those can be dubious at times.

Link to comment
Share on other sites

Mail was designed to inject outgoing mail into the system MTA (mail transfer agent).  Thus it has no visibility into deliverability.  SMTP (the mail transfer protocol) has no insight into this either, unless the smtp connection is rejected, or the mail server returns an error message.  From the php application standpoint, it just knows it dropped off mail at the post office. 

This is why libraries like phpmailer and symfony mailer were created, as they are designed to handle more of the process.  Sending email with even a modicum of deliverability is a non-trivial task, which is one of many reasons why there are companies that take care of a lot of the problem.  The mail libraries listed are also suited to integration with many of the popular remailing services (mailchimp, mailgun, sendgrid etc.)

Link to comment
Share on other sites

Mailgun and Sendgrid are pretty good, yeah. Although - in my experience - even they sometimes seem like they're guessing at statistics.

Edit: I realize I sound like I'm shitting on email services; I'm not. They're far more reliable than home-grown or most native solutions, but I remember a campaign I worked that reported like 80% open rate and 65% click-through on Sendgrid and I was like "uhhh ... nah, dude. I don't think so."

Edited by maxxd
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.