I'm developing an email marketing system which allows users to send emails to multiple addresses. I have a list of tasks that need to be done, probably I will have many questions regarding to these tasks. Here's one of them: As I said, users are sending out emails to multiple addresses. I want to check for every sent out emails if the receipient address blocks the email and the reason of the block.
Usually this is coming back to an email from Mail Delivery System. I think the solution has to be somewhere around the idea of checking the incoming emails somehow. Please help me finding the best solution.
Thanks
**
UPDATE:
**
I'm going to update the content of the question. I forgot to say that these emails are sent our from a valid SMTP server with username and password, there should be a way to get the content of inbox from PHP somehow.
I want to check for every sent out emails if the receipient address blocks the email and the reason of the block.
Forget it. Most spam filters will just swallow unwanted E-Mail without comment (so as to not give spammers any hint about their success or failure).
Also, you won't be able to find out if a user simply deleted your E-Mail straight away, or had a rule set up in their E-Mail client to delete it. This is information that you will never get hold of unless the recipient tells you.
Only a tiniest fraction of rejected E-Mails will actually cause a reply to go out to the E-Mail sender address - if any! I, for one, have had mails swallowed by spam filters, but I've never received a reply saying "your E-Mail was filtered as spam". Have you?
What you can do is catch E-Mails whose delivery failed for technical reasons - unknown recipient, recipient mailbox full, relaying failed... Those will be returned as "mailer-daemon" error messages to either the sender address, or the address specified in the errors-to header. Those mails you could parse using PHP. But I don't think this is what you want.
Related
I am using PHPMailer to send emails, I need to rectify which of my emails have been reached successfully to receiver's inbox. Is there any way to get the acknowledgement or delivery receipt for each email sent?
If possible I need those email id's inserted into my MySQL database.
There are several approaches to this, none of which are reliable.
You can request delivery receipts by adding the Disposition-Notification-To header. PHPMailer has built-in support for this:
$mail->ConfirmReadingTo = 'confirmations#example.com';
Not many clients support this, and even if they do, it's likely they have it disabled for security reasons. Generally it's only likely to work within company intranets.
Secondly you can add an opening tracker or beacon image in your message body so that when a clint opens the message, the loading of the image tells you which message was opened. You need to embed a unique identifier for the recipient and/or the message in the URL, such as a hash of the email address and timestamp. Again, this is not reliable because most clients have image loading off by default, or the images may be opened by inbound mail scanners, giving you false positives.
The most effective way is really to get to know your mail server, and handle bounces correctly, but even then, just because a message has been devivered successfully to the recipient's mail server does not tell you whether it reached their inbox, nor whether it has been seen or opened.
We use PHP on CentOS 6.4 to send emails for our business.
For reasons that I won't go into, emails go out FROM the user's email address (to ensure they get all replies and out of office responses) with our email address as SENDER (to get around SPF checks) and our ndr mailbox as ENVELOPE-SENDER (to catch bounce-backs). Using their email in the FORM address is something we do not want to change.
Following Yahoo.com & AOL.com's decision to increase their DMARC policy, using the ENVELOPE-SENDER now fails their checks (despite specifying a SENDER!). However, skipping this step means that we don't get any bounce backs and it is vital that we receive these.
Specifying RETURN-PATH in the mail headers doesn't work as is widely reported.
Am I missing something?
Thanks.
My company sends emails on behalf of our many customers, to other customers (to protect anonymity of the receiver until they choose to respond, at which point the emails should travel only between the 2 customers).
We were spoofing the 'From' address, until this recent restrictive change. So what I have done to fix it is:
Set 'sender' and 'return-path' to 'mbox#mycompany.com'. This allows the receiving server to check that the sending mailbox exists and catches bounces.
Set 'reply-to' to 'customer1#something.com', the original sender's email.
Out of thousands of emails in the 2 days since I implemented this, we have received 14 email responses mistakenly addressed to 'mbox#mycompany.com'. 5 turned out to be the sender hitting Reply All and we got CC'ed. 4 were due to the sender creating a new email and copying our email address instead of using Reply. Of the remainder, about half are sent from yahoo.com and aol.com, so I'm still working on why they aren't respecting the reply-to in a small percentage of cases.
So basically, my fix worked for all but 0.003% of emails. I'll reply to this answer if I can determine what causes the remainder of the failures.
It appears to be the case that envelope-sender and sender not matching is not causing your problem. Here is the part of the spec that appears to be relevant:
https://datatracker.ietf.org/doc/draft-kucherawy-dmarc-base/?include_text=1
The domain name extracted from a message's RFC5322.From field is
the primary identifier in the DMARC mechanism. This identifier is
used in conjunction with the results of the underlying
authentication technologies to evaluate results under DMARC.
If I am reading this correctly (and if email recipients are actually following spec), then it's basically up to Yahoo to reverse their decision, and there's little you can do except not use yahoo.com addresses as from addresses.
im building system, that tracks bounce emails and also when user reply back with message, then other user can read the message of this user.
so far i have read from all the questions / answers, that bounce email can be sent to return-path or also to reply-to path.
how can i tackle this issue? should i scan and see if its bounce email, if its not, then consider it as message email or there is some other way around it?
checking for bounce email and then parsing for message, its just extra overhead, when system is getting lots and lots of emails from bounce or as messages.
Bounce should be sent back to address given in From while for replies you can provide alternate address in Reply-To header. So if you set two different addresses there (ie. From: bounce#... and Reply-To: reply#...., and process mails arriving
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to check if an email address exists without sending an email?
Possible duplicate:
How to check if an email exists without sending an email?
I have a very big database with users (over 50000) and there are lots of automated e-mails the site sends out.
The problem is, quite a few of the addresses in the database (that users registered with years ago) have expired or have been deleted or no longer exist for whatever reason.
This creates an issue, because each user should have a valid e-mail.
I've been trying to find out if there's a way to detect whether an e-mail address is active, so we could update the database and prompt those users to enter a new e-mail? Something like a ping for e-mail addresses?
There's some code here that I've tried to figure out but to no avail:
http://www.webdigi.co.uk/blog/2009/how-to-check-if-an-email-address-exists-without-sending-an-email/smtpvalidateclassphp/
Does anyone have a solution?
Please note that I need a PHP solution, not command line since I have 50k e-mails to check.
Two things, first you should stop the influx of potentially in-valid email addresses by implementing a 'closed-loop' email verification system. Basically, when a user signs up for your site, you send an email with a link confirming their email address, and when they confirm, their account gets full access to your site.
Secondly, there is no real way to determine if an an email address is invalid strictly using PHP. I had to tackle this problem a few months ago, and we ended up using the mail-server to tell us if an email address has been bounced back or not. When your mail server sends an email, and the email cannot be delivered, the recipient mail-server will respond with a bounce notification to your mail-server which includes information as to why the email was bounced. Information such as a Delivery Status Notification (DSN) code which identifies why the email address couldn't be delivered.
Some example codes:
511: Bad Mailbox
512: Bad System
516: Mailbox Moved
These codes are made up of a prefix (4 or 5) to indicate a transient (temporary) or permanent failure. The following two digit code indicates an error range; two digit codes between 10 and 19 indicate an error relating to the email address, whereas codes between 20 and 29 indicate an error relating to the email mailbox.
From these codes you can determine, based on business requirements, a 'hard bounce' or a 'soft bounce'. A hard bounce would be something like 511 (bad mailbox), where it's certain that this email address is not currently valid. A soft bounce would be something like 445 (network congested), which indicates that it was a temporary issue as to why the email could not be delivered.
So in your instance, you could send out an email blast, and then track the bounces on your mail server. By looking at each bounce and the respective DSN code, you can flag whether an account's email is valid or not (we used PHP to gain access to the mail server and parse the bounce notifications for the DSN codes)
Here is more information on DSN codes.
-- Edit --
As Dagon wisely mentioned, you can pipe bounced emails into a PHP script upon their receipt. To do this you will need to read up on your mailserver config, but ours looks similar to the following:
bouncehandler unix - n n - - pipe
user=nobody argv=/usr/bin/php /path/to/BounceHandler.php
<% end %>
The only way to check if an e-mail address is expired or not is to send an e-mail message to it and see if you get a response. But note that doing so may be considered spamming, since it is an unsolicited message.
You can check if an e-mail address if properly formed, and if the mail server it specifies actually exists, but thats about it. There is no way that I know of to check if the account exists (and if a human is reading the mail sent there) without sending a mail with a link and requesting that the user click the link.
My email address on www.email.it has been disabled because I haven't used it for a long time.
Now, when I go on a FB, I get this message:
"Our systems have detected that xxxxxxx#email.it is no longer a valid email. "
So my question is:
How these systems can detect if an email is valid ?
You cannot detect if an email is fake. All you can do is to detect whether a string respects the RFC 5322 of a valid email address format. You can't possibly know whether such an account has been declared at the target SMTP server unless you own this server. You can probably try to send an email to this address and see what does the remote SMTP server responds.
You can't reliably determine if an email is valid or not. SMTP servers are suppose to implement the VRFY command but many have this disabled to prevent spammers from being able to detect valid email address.
Additionally, even if an email address respects the RFC 5322 valid email address format does not mean that it is a valid email address on the destination server; many servers do not correctly implement this standard!
The best that you can do is send an email to the address with a click back link in the email. If the email address is valid and the user reads the email and the user clicks the link then it might be the case that the email address is valid (it could have been intercepted too thus giving you a false positive).
If the email bounces back, it might indicate that the email address is not valid (but it could also be the case that the destination server is down, or the mailbox is full, or who knows what else).
As you can see, SMTP is remarkably unreliable given how well it works in practice.
Most likely Facebook tried to send mail to that address. They know that the address isn't valid because the mail bounced.
Perhaps they tried to send an email (such as an update EULA) to said host and it responded in an unkind fashion -- hence "not valid"
SMTP is sort of stupid on how it handles -- or doesn't handle -- "can't deliver" messages uniformly, but the various detections may work "well enough" (VRFY, inspecting automatic reply messages, etc.)
I am pretty sure that FB had sent you any kind of email , and since that your mail is deleted or deactivated ..... there for your email will bounce back to them with the error message like :
No such user
mailbox unavailable
etc ..
so they were able to know that and deactivate your account
if you curious to know that error message just send an email and wait for it to bounce back to you
simple but handy :)
What some companies do (and possibly FB as well, though I don't know for certain) is periodically send an email to the account, simply to see if it is "live" - they will request the receiver to click a link on it to prove the email address is still in use.
After several such emails that have received no response (or were bounced), they will consider the email address "dead".