email-bounces interview questions
Top email-bounces frequently asked interview questions
I recently moved my transactional email sending to Mailgun
It works good so far however I am wondering about the return-path header.
Consider this email (I removed irrelevant header and replaced email/domain for privacy purposes)
Delivered-To: RECIEVER@gmail.com
Received: by 10.76.154.104 with SMTP id vn8csp478308oab;
Wed, 4 Sep 2013 05:04:44 -0700 (PDT)
X-Received: by 10.50.22.105 with SMTP id c9mr1537992igf.36.1378296283817;
Wed, 04 Sep 2013 05:04:43 -0700 (PDT)
Return-Path: <bounce+a801a1.c2b37-RECIEVER=gmail.com@my-website.com>
Received: from so254-63.mailgun.net (so254-63.mailgun.net. [198.61.254.63])
by mx.google.com with ESMTP id k5si1620852igx.55.1969.12.31.16.00.00;
Wed, 04 Sep 2013 05:04:43 -0700 (PDT)
Received-SPF: ...stripped...
Authentication-Results: ...stripped...
DKIM-Signature: ...stripped...
DomainKey-Signature: ...stripped...
Received: by luna.mailgun.net with HTTP; Wed, 04 Sep 2013 12:04:42 +0000
Mime-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Subject: ...stripped...
From: my-website <support@my-website.com>
To: RECIEVER@gmail.com
Message-Id: <20130904120442.1488.88532@my-website.com>
X-Mailgun-Sid: WyI5YmI1OSIsICJqb2Vob3BmK2VlZ2VpN2lkMm9pbW9vYm9vZmFpQGdtYWlsLmNvbSIsICJjMmIzNyJd
Date: Wed, 04 Sep 2013 12:04:43 +0000
Sender: support@my-website.com
Content-Transfer-Encoding: base64
...email body...
This is the Raw email displayed from an actual mail in a gmail inbox.
As you can see the Return-Path header contains an email adress that ends in @my-website.com
But I have only set up dns records for outgoing email (spf, domainkey, etc).
Not for incoming email. Meaning, my MX records still point to mailservers somewhere else (In my case google apps).
How is it possible then that the bounce email arrives at mailgun servers?
I would have expected to see an email adress ending in @some-mailgun-server.com
in the Return-Path
header!
I have been using Amazon SES before, and there they had Return-Path
header ending in amazonses.com
I asked the mailgun support and got this response:
Nick: your setup is correct, Mailgun will still automatically handle
the bounces even though your mx records are pointing elsewhere
They just assured me that everything was fine but gave me no explanation (which is okay since their job is not to teach me things i dont know but to deliver reliable email service...)
So I hope somebody can explain this to me.
I hope the point is clear, if not please ask and I will try to clearify my question.
EDIT:
One theory of me is that the bounce email is indeed sent to google mail servers where it is discareded. However that this is redundant since the error response is also sent to the sending mailserver during the process (when it opens its tcp conneciton to the target mail server).
To test this theory and since the Return-Path email is in the form of bounce+SOMETHING@my-website.com
, and google delivers all email, regardless of what comes after the +
character, to the user in front of it, I went ahead and created the account bounce@my-domain.com
on google apps.
I also tried to send an email to bounce+a801a1.c2b37-RECIEVER=gmail.com@my-website.com
.
It made it through to my inbox.
Now I expected to recieve bounce traffic in my inbox. So I sent an email to an inexistent hotmail address. I did not recieve email on my google apps inbox, and mailgun sucessfully tracked the bounce.
So... It appears that it does indeed work. I just dont understand why.
One more theory I have is that the mailserver to which the bounce email is delivered is never resolved using its MX records. Rather always the delivering server, in this case luna.mailgun.net
is chosen.
The domain ending in the Return-Path
address is just the name of the mailbox on the server, but the domain has nothing to do with the server where the mail is actually delivered.
Then it would also make sense to make it like this since it might improve deliverability if the domains of From
and Return-Path
adress match.
However this is only a theory. And it would also mean that a mailbox wich is able to recieve bounces, must be on the same server that is used for sending.
In other words it would be impossible to have a mailbox to recieve bounce email adresses that is hosted somewhere else than the actual server sending the mail. But this sounds strange to me as well...
I hope somebody can enlighten me.
Source: (StackOverflow)
I'm wondering whether it's safe to mark bounce messages containing "This is a permanent error." string from the first time?
When I get "This is a permanent error." doesn't mean "permanent error" for this message or for the user?
Source: (StackOverflow)
I need advice on processing/tracking bounce emails.
We have a scenario, where we need to send emails to recipient on behalf of our customers.
lets say we need to send email to user@recipient.com with from as emailer@cusotmer.com but when this email fails we need to receive the bounce/failure notification on mybouncetracker@mydomain.com
I tried using the reply-to/return-path but both getting replaced with emailer@cusotmer.com.
We were not able to process bounce message as we dont own the inbox for emailer@cusotmer.com.
Please help!!..
We created smtp client on C#.net
Source: (StackOverflow)
I'm using the Spring java mailer class to send email messages to my users:
org.springframework.mail.javamail.JavaMailSenderImpl version 1.4 using Spring framework 3.0.7.RELEASE.
I want to set the bounce back message for a failed email to go to my user's email address that doesn't have the same domain as my smtp server. Does anyone know a way to accomplish this?
For example:
My system sends an email to email-does-not-exist@gmail.com. My smtp server is configured to have a domain somebusiness.com. Upon failure, send the bounceback to my user: test.user@gmail.com.
I read the following article several times:
Specifying the bounce-back address for email
I tried to use their method of setting the mail.smtp.from property but it won't send any emails at all (not even counting bounceback attempts from invalid emails yet).
Properties p = new Properties();
p.put("mail.smtp.from", "test.user@gmail.com"); //If I comment this out, it sends emails again
mailSender.setJavaMailProperties(p);
Session session = Session.getDefaultInstance(p, null);
MimeMessage mimeMessage = new MimeMessage(session);
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage,
false, "utf-8");
mimeMessage.setContent(emailBody, "text/html");
helper.setTo(toAddress);
helper.setSubject(subject);
helper.setFrom(fromAddress);
mailSender.send(mimeMessage);
Anyone have an idea of why? The obvious answer seems like the smtp server we are using is blocking it but I was hoping for potential other ideas.
Source: (StackOverflow)
We use aws server and our application sends emails to customers via Amazon's Simple Email Service (SES).
When recipients turn on vacation responder, SES treats them as bounces and blocks that email id after few sends.
Is this a standard problem of SES or I am missing something? Any help would be appreciated.
This is how my PHP code is sending email via ses
define( 'AWSAccessKeyId', $this->SNS_Access_Key_Id );
define( 'AWSSecretKey', $this->SNS_Secret_Key_Id );
$transport = Swift_AWSTransport::newInstance( AWSAccessKeyId, AWSSecretKey );
$transport->setDebug( true );
$mailer = Swift_Mailer::newInstance( $transport );
$message = Swift_Message::newInstance()
->setSubject( $email_subject )
->setFrom( array( $from_email_id ) )
->setTo( $to_email_id_array )
->setBody( $email_body, 'text/html' );
$response = $mailer->send( $message );
Source: (StackOverflow)
Using Java mail, I would like to send an e-mail and check the status. Possible statuses include:
- Hard-bounce: No mail server found
- Soft-bounce: Mail server found, but account not found
- Success
Is it even possible to send an e-mail and get some feedback about the delivery attempt in the manner I've described above?
EDIT: A respondent suggested looking for a Java library that provides the same functionality as ListNanny. I've searched around, but haven't found anything. Any idea if such a library exists?
Cheers,
Don
Source: (StackOverflow)
What im trying to do is to set up smail mail server with lamson (lamsonproject.org). Its working very well, but i have problem with setting return path and for that reason, bounces are going to 'From' address and therefore not reaching my mail server.
Lamson uses pythons smtplib to send mails out.
The "talk" between my project and my smtp server goes like that:
send: 'ehlo xxx.mydomiain.com\r\n'
reply: '250-smtp.smtpserver.com\r\n'
reply: '250-PIPELINING\r\n'
reply: '250-SIZE 20000000\r\n'
reply: '250-VRFY\r\n'
reply: '250-ETRN\r\n'
reply: '250-STARTTLS\r\n'
reply: '250-XVERP\r\n'
reply: '250 8BITMIME\r\n'
reply: retcode (250); Msg: smtp.smtpserver.com
PIPELINING
SIZE 20000000
VRFY
ETRN
STARTTLS
XVERP
8BITMIME
send: u'mail FROM:<me@myotherdomain.com> size=352\r\n'
reply: '250 Ok\r\n'
reply: retcode (250); Msg: Ok
send: u'rcpt TO:<pleasebouncethis@myotherdomain.com>\r\n'
reply: '250 Ok\r\n'
reply: retcode (250); Msg: Ok
send: 'data\r\n'
reply: '354 End data with <CR><LF>.<CR><LF>\r\n'
reply: retcode (354); Msg: End data with <CR><LF>.<CR><LF>
data: (354, 'End data with <CR><LF>.<CR><LF>')
send: 'MIME-Version: 1.0\r\nTo: pleasebouncethis@myotherdomain.com\r\nSubject: Testing bounces\r\nSender: MAILER-DAEMON@mydomiain.com\r\nReturn-Path: MAILER-DAEMON@mydomain.com\r\nReply-To: MAILER-DAEMON@mydomain.com\r\nMessage-Id: 377b8dcdf661810d3dc73a4a01fe23b3\r\nFrom: me@myotherdomain.com\r\nContent-Type: text/plain; charset="utf-8"\r\nContent-Transfer-Encoding: base64\r\n\r\nc2RmZ2TDpGfDpGRsZsOkZ2xkZmc=\r\n.\r\n'
reply: '250 Ok: queued as E635D157D3\r\n'
reply: retcode (250); Msg: Ok: queued as E635D157D3
data: (250, 'Ok: queued as E635D157D3')
send: 'quit\r\n'
reply: '221 Bye\r\n'
reply: retcode (221); Msg: Bye
Done
so i can see, that the Return-Path is indeed in headers.
While looking for an answer i found this :
Setting Return-Path with Python sendmail for a MIME message
Last comment in the answer is:
Errors/bounces/etc. should go to the Envelope sender, not the address in From:.
When looking up Envelope sender and how to specify, i came across this wiki article:
http://en.wikipedia.org/wiki/Bounce_address
This lists another possible header parameters like:
return path, reverse path, envelope from, envelope sender, MAIL FROM, 2821-FROM, return address, From_, Errors-to.
I put all those into mail headers and - Voila - It worked.
My question is now - Do i really have to ALWAYS list so many possible options for return path in mail headers? Have the mail servers been configured to accept one or two of those parameters now? Are there better ways to make sure, that mail is returned to my mail server, when it bounces?
Alan.
Source: (StackOverflow)
I am making a email marketing system in which I am sending emails in bulk and there are chances to bounce some emails. I need a solution so that all the email addresses which are spelt incorrectly or failed to send due to any error, should back into the specified address.
Please help me how can I meet these requirements with phpmailer.
Thanks in advance
Source: (StackOverflow)
Similar to Gmail. Any way to retrieve emails sent to my Gmail Apps domain email that bounced?.
We have a google apps for work gmail that is not receiving an email from Zapier (routed through another two servers, one of which is mailgun, with a 605 error)
The difference between this one and the other is that we have checked our MX records (they are pointing to googles servers), google techs have helped us check this, but not able to offer an answer. Having followed up with three teams, I have come to stack for help.
Attached is the code.
{
"severity": "permanent",
"tags": [],
"delivery-status": {
"message": null,
"code": 605,
"description": "Not delivering to previously bounced address",
"session-seconds": 0
},
"envelope": {
"targets": "radub@nwwpros.com",
"transport": "smtp",
"sender": "contact@zapier.com"
},
"recipient-domain": "nwwpros.com",
"id": "Y0wp1sUWRs2aBtLZYJlvOg",
"campaigns": [],
"reason": "suppress-bounce",
"user-variables": {},
"flags": {
"is-routed": null,
"is-authenticated": true,
"is-system-test": false,
"is-test-mode": false
},
"log-level": "error",
"timestamp": 1444147226.022885,
"message": {
"headers": {
"to": "radub@nwwpros.com",
"message-id": "20151006160014.2675.4025@zapier.com",
"from": "Zapier <contact@zapier.com>",
"subject": "[ALERT] Possible error on your \"Ask them how we did\" Zap!"
},
"attachments": [],
"recipients": [
"radub@nwwpros.com"
],
"size": 42617
},
"recipient": "radub@nwwpros.com",
"event": "failed"
}
Source: (StackOverflow)
When mailman receives a bounceback in a format that it doesn't recognize, it discards the message and sends an "Uncaught bounce notification" to the list administrator.
How would it be possible to define new templates or rules for mailman to process bounces?
For example, the message below is unrecognized by mailman, but is a common bounceback message from a particular domain that many of my list members are using. I would like to be able to have mailman process these automatically.
This message was created automatically by mail delivery software.
A message that you have sent could not be delivered to one or more
recipients. This is a permanent error. The following address failed:
<user@domain.com>: 550 5.1.1 User unknown
Source: (StackOverflow)
I use the Mandrill API to get the rejection list, and currently for entries where they are marked as hard-bounce
, spam
or unsub
I remove them from my mailing list so that I will not attempt to send to them any more.
However, I am not sure how to approach dealing with addresses that have been marked as soft-bounce
.
The documentation seems to indicate that these may be transient errors, and that unlike say MailChimp, soft bounces don't harden over time.
Mandrill doesn't automatically convert soft bounces to hard bounces. If you're seeing a lot of soft bounces to an address, it may be a sign that the address is unusable.1
How have others approached these soft bounces when trying to keep their lists high in quality? I have considered maybe keeping a count of how many days they have been there, but I have no way to know how Mandrill determine how long that they keep items on the list before attempting again.
In summary: How should soft bounces be managed by the sender to ensure high quality lists?
Here's an example of the JSON returned on one of my soft bounces that should (by looking at the obviously fake email address) be eventually removed:
{
"reason": "soft-bounce",
"detail": "smtp;550 \"aaa@wp.pl\": This account is disabled or not yet active (#5.1.1)",
"last_event_at": "2015-10-06 10:16:46",
"email": "aaa@wp.pl",
"created_at": "2015-10-02 10:10:56",
"expires_at": "2015-10-08 10:16:46",
"expired": false,
"subaccount": "XXXXXXXX"
,"sender": null
}
Source: (StackOverflow)
I have configured postfix to relay mail to Amazon SES by following their integration guide and sending email is working without issue.
However, I recently wrote a PHP application using a framework which produced a malformed email message.
SES rejects the email with "554 Transaction failed: Expected MIME type, got =" which is acceptable.
However, my local postfix server then attempts to send a sender non-delivery notification with a from=<> which gets pushed through to the relay address.
SES rejects stating "501 Invalid MAIL FROM address provided (in reply to MAIL FROM command))" and postfix removes the bounce message from the queue.
Question is, what is the easier way to ensure I get the original 554 bounce message sent to me? I don't see a way to make the SES relay accept empty from fields, so I believe the solution would lay in configuring postfix to deliver the bounce message directly to me.
Note, I use the term 'bounced mail' perhaps incorrectly. The mail is perhaps rejected but I'm not sure of the correct nomenclature for this scenario. The key point is that the message is not accepted by the SES relay, so it hasn't in fact gone 'out the door' so to speak.
Jun 12 03:11:21 myserver postfix/smtp[6353]: 411BA21795: to=<valid@validdomain.com>, relay=email-smtp.us-east-1.amazonaws.com[54.243.192.132]:25, delay=0.29, delays=0.05/0.02/0.15/0.07, dsn=5.0.0, status=bounced (host email-smtp.us-east-1.amazonaws.com[54.243 .192.132] said: 554 Transaction failed: Expected MIME type, got = (in reply to end of DATA command))
Jun 12 03:11:21 myserver postfix/cleanup[6351]: 93F202179B: message-id=
Jun 12 03:11:21 myserver postfix/qmgr[895]: 93F202179B: from=<>, size=4673, nrcpt=1 (queue active)
Jun 12 03:11:21 myserver postfix/bounce[6354]: 411BA21795: sender non-delivery notification: 93F202179B
Jun 12 03:11:21 myserver postfix/qmgr[895]: 411BA21795: removed
Jun 12 03:11:21 myserver postfix/smtp[6353]: 93F202179B: to=<valid@validdomain.com>, relay=email-smtp.us-east-1.amazona ws.com[23.21.161.144]:25, delay=0.17, delays=0.01/0/0.15/0, dsn=5.0.0, status=bounced (host email-smtp.us-east-1.amazonaws.com[23. 21.161.144] said: 501 Invalid MAIL FROM address provided (in reply to MAIL FROM command))
Jun 12 03:11:21 myserver postfix/qmgr[895]: 93F202179B: removed
Source: (StackOverflow)
I have tried searching but I got only online paid services, no code to test that given email address is really exists, so I can prevent a hard bounce.
Please see the below code which can only check the domain. Need help is it possible. Solution can be in any language, PHP (preferred), JAVA, .NET, Rudy
public function check_domain($email)
{
if( ! (bool) checkdnsrr(preg_replace('/^[^@]++@/', '', $email), 'MX'))
{
return FALSE;
}
return TRUE;
}
Update
Using online services it shows something like this
MX record found: mta6.am0.yahoodns.net (Priority 1)
MX record found: mta5.am0.yahoodns.net (Priority 1)
MX record found: mta7.am0.yahoodns.net (Priority 1)
Connecting to mta6.am0.yahoodns.net
Connected to mta6.am0.yahoodns.net
Dialog with mta6.am0.yahoodns.net ok
------------------------------------------------------------
220 mta1278.mail.bf1.yahoo.com ESMTP ready
HELO verifyemailaddress.org
250 mta1278.mail.bf1.yahoo.com
MAIL FROM: <noreply@verifyemailaddress.org>
250 sender <noreply@verifyemailaddress.org> ok
RCPT TO: <xxxxx@yahoo.com>
250 recipient <xxxxxx@yahoo.com> ok
QUIT
221 mta1278.mail.bf1.yahoo.com
------------------------------------------------------------
Email address xxxxxx@yahoo.com accepted
What they are doing exactly, sending an email ??
Source: (StackOverflow)
I just wrote my first application using the AWS SDK for .Net to send ~7500 emails via SES with the following code:
AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient("awsKey", "awsSecret");
SendEmailRequest req = new SendEmailRequest()
.WithDestination(new Destination() { ToAddresses = { "you@yourdomain.com" } })
.WithSource("me@mydomain.com")
.WithReturnPath("me@mydomain.com")
.WithMessage(
new Amazon.SimpleEmail.Model.Message(new Content("mySubject"),
new Body().WithHtml(new Content("myBody"))));
var resp = client.SendEmail(req);
My AWS Console is showing successful deliveries of ~7350 emails and ~150 bounces.
It has been over 3 hours since it finished and I still have not received any bounce back emails ("This email could not be sent because the address doesn't exist or something...") to me@mydomain.com.
How do I find out which of those ~150 emails bounced so I can update my database?
Source: (StackOverflow)
While the SES dashboard shows aggregated statistics about the bounce rate of emails sent through the service, I do not see a way of retrieving the individual addresses that bounced. Is this possible? Our situation is that the 'from' address we had set in certain emails was incorrect and resolved to a non existant mailbox on our (verfied sender) domain, so anything SES would have forwarded to the from address is likely gone.
Source: (StackOverflow)