0

I run my own mail server, which (among other things) handles emails for one of my services. The service in question takes bookings and sends booking confirmation emails. The emails come from noreply@mydomain.com with a Reply To header set to the email address for the organizer.

Some email clients seem not to honor the Reply To header, and so I get emails sent to the noreply@mydomain.com email.

I have setup postfix to catch these and run a script that looks up the event in question and replies to the email detailing the correct email address for the event, and this all works fine.

The problem is that I also get a lot of spam sent to that email address, so I would rather the reply was a bounce (rather than a new email) to discourage spam, but I'm not sure how to achieve this (or if it's even possible).

What makes a bounce email a bounce email? Does it have to be generated from the sending email server in response to an SMTP error? If so, how do I make it bounce and customize the bounce message (I'm using postfix and this method to run the script). If not, can I modify the email I send in the script to be a bounce email? How do I do this? Is it specific headers in the email?

  • Why have noreply@ accepting mail at all? You could just reject it. – Michael Hampton May 29 at 16:54
  • @MichaelHampton - because I want to respond with a customized email that helps the user, in the cases that it is a legitimate user. – Ben Holness May 29 at 16:57
  • Just give them a normal reply address, then? – Michael Hampton May 29 at 16:58
  • They are not supposed to reply to the from email address, hence it is a noreply. The reply to email address is set to the normal reply address, as stated in my post. – Ben Holness May 29 at 17:00
1

A receiving MTA should never bounce. SMTP connection-stage rejection is the only way to avoid sending backscatter. Your script would soon become a tool for sending spam.

You can customize the human readable error message. Every sending MTA getting the error from yours will create a bounce with their usual template, but the error message is always somewhere.

A customer should have had bounces before and realize there was something wrong with the recipient address. At least some of them care to try and find your error message, or ask someone who can... read them English.

Example configuration for a custom error message in Postfix:

  • Postfix main.cf:

    smtpd_recipient_restrictions =
        . . .
        check_recipient_access hash:/etc/postfix/denied_recipients,
        . . .
    
  • /etc/postfix/denied_recipients:

    noreply@example.com REJECT This address does not accept email. See https://example.com/contact
    
  • postmap /etc/postfix/denied_recipients, because it's a hash: Berkeley DB.

  • The thing is that I still want to use a script so that I can get the details of the event (including the correct email address) to include in the bounce message (if that's possible), hence wondering if I can do this from a script. – Ben Holness May 29 at 16:39
  • My ideal situation would be to have the script cause postfix to REJECT the message and provide it with the custom message, but that's the part that I'm not sure whether it's possible or not. – Ben Holness May 29 at 20:51
  • 1
    That would require building a custom milter application. It's more than just a script, because it needs to use the Sendmail 8 Milter protocol, but it's possible. – Esa Jokinen May 30 at 4:35
  • Thanks Esa - I will read up on it! – Ben Holness May 30 at 5:34
  • For anyone looking this up later, I found github.com/mschout/milter-limit which is a perl based milter limiting script using Sendmail::PMilter and looks like a good place to help figure out how to build what I want! – Ben Holness May 30 at 17:11
-1

The entire point of a "noreply@somedomain.tld" address is that it doesn't go anywhere.

Put the address to which you want people to reply in the body of the mail, and remove the noreply mailbox from your server(s). In this way everybody sending to the noreply address gets their mail bounced - including spammers - but all literate and legitimate users will know how to get a mail through to the correct address.

  • I do not have control over the body of the mail, it is customized by the event organizer. Besides which, even if it was there, some people would still reply and I want to provide a good customer service by looking for legitimate accidental replies to the noreply address and dealing with them nicely, if I can. I do not mind putting in the work to do so. – Ben Holness May 29 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.