how to set difference between reply and bounce email - php

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

Related

Can Mandrill send bounced mail information to sender email

I'm building a service for a company. The users of the service will send survey links to a list of email addresses. I'm going to use Mandrill as an email engine for this. The service is built using Laravel.
The users will feed a list of email addresses to the service that will generate emails (unique for every email address) and send them through the Mandrill API.
BUT, of course there will be errors made by the users. They will feed some bad email addresses in and emails will bounce. I need to find of way of notifying the users of the service that some emails have bounced.
Is there a way to get Mandrill to send a list of bounced emails to the sender or reply address?
Me as a developer has the Mandrill account of course, but I'm not interested in the bounce information - that has to go to the users of the system. So they can take action and correct the errors.
Thank you.
I see from Mandrill API that it is possible to get the status of sent e-mails with call /exports/activity.json as described in https://mandrillapp.com/api/docs/exports.JSON.html#method-activity
If you get any bounced e-mails from there then you can manually send the corresponding messages to the users who you want to.

Sending E-Mail from contact form with the visitors sender address

I've built a contact form in which a sites visitor enters a message, subject and his own email address. The email then is sent to a fixed gmail address.
I'd like the receiver of the mail to be able to just click on answering in order to respond. Therefore I set the senders email to that one entered by the sites visitor.
Problem is, gmail considers those mails as spam. I guess because the DNS of the senders address does not fit to the servers IP.
So I wonder if there is a strategy to achieve what I have described.
There are other email addresses you can add that will probably fix your problem. I suggest that you give your email From, Sender and Reply-To addresses:
From: visitor's email
Sender: your email
Reply-To: visitor's email
Reply-To is the address any reply will go to. Sender means that the email coming from you makes sense. From indicates that you are sending it on behalf of the visitor.

Avoid DMARC blocks while using Envelope-Sender in PHP mail()

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.

php send email from another domain

I am making an application that allows users to send emails of complaint to a leader at my university. I would like them to as much as possible to appear they are coming from the users own email rather than from the website.
I'd use mailto links but I find a lot of people these days don't use outlook... most people use web mail :S
I guess the other option is to use the reply to field so at least the replies end up in the right inbox.
The send function allows you to specify additional headers - this includes From: and Reply-To.
However, you should make sure your mails are white-listed in the spam detection configuration, because anti-spam tools will (rightfully) mark your mails as spam.
You can't do this reliably: A faked sender address is among the #1 signs for spam and is likely to be filtered out.
The best you can do is specify a legit sender address on your server, and give the user's address in the reply-to header. In most mail clients, that address will show up as the sender.
As Pekka highlighted, you can set the from address but this is likely to get it specified as spam.
An alternative would be to send the email to the user with instructions for them to forward the mail to the University Leader, a bit roundabout but might do the trick.

How to handle email address status in PHP?

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.

Categories