Skip to contentSkip to conversation

Proper procedure for bounced mails?

DISCUSSION Jens Knoell 3 participants 6 messages Jul 22, 2002 – Jul 23, 2002

lore
Share & tools
lore
#0 lore raw

It's probably somewhat OT - is there an established procedure for bouncing mails? Special headers and the like? A net search wasn't exactly helpful... does anyone know a good resource to read up on that?

Thanks
Jens

#1 lore raw

On Mon, Jul 22, 2002 at 02:29:59AM -0600, Jens Knoell wrote:

| It's probably somewhat OT - is there an established procedure for bouncing
| mails? Special headers and the like? A net search wasn't exactly helpful...
| does anyone know a good resource to read up on that?

How and why do you want to bounce email?

Sendmail and friends automatically bounce mail if the recipient address is unknown. I don't recommend bouncing spam as the sender address is likely to be fake and you could accidentally mailbomb someone innocent.

And it's probably not OT if you're using Linux mail servers ;-)

Signature · 4 lines
I will not aim for the head  
 
PGP Fingerprint [6AD6 865A BF6E 76BB 1FC2 E4C4 DEEA 7D08 D511 E149]
PGP Public key  [www.piku.org.uk/public-key.asc] - Home [www.piku.org.uk]
#2 lore raw

From: "James" <[email protected]>

Quoted 2 lines · Jens Knoell

| It's probably somewhat OT - is there an established procedure for

bouncing

Quoted 1 line

| mails? Special headers and the like? A net search wasn't exactly

helpful...

Quoted 3 lines

| does anyone know a good resource to read up on that?

How and why do you want to bounce email?

How: from a custom, not-yet-totally-finished script that is supposed to filter all incoming mail based on certain per-user conditions in an SQL database.

The idea is to bounce mails only once per sender per day. So far, I've been using "custom" reply mails, as well as informing the recipient by sending them some tiny email. So far so good - but I'd like to re-format the reply mails to be a little more compliant to standards (if there are any for such things).

Quoted 3 lines

Sendmail and friends automatically bounce mail if the recipient address is unknown. I don't recommend bouncing spam as the sender address is likely to be fake and you could accidentally mailbomb someone innocent.

Correct. That's why I'd like to make sure the bounces are somewhat conforming to standard formats. On the other hand, bouncing spam does get people off spamlists - yet I can't just pretend that the user doesn't exist, as that will confuse the rare legit sender whose mail gets rejected for one reason or another.
Unconditionally dropping them doesn't get people off spamlists either (tested that in lengthy experiments). To prevent mailbombing, I'd rather like to use a "warn once per day" filter on my side.

Quoted 1 line

And it's probably not OT if you're using Linux mail servers ;-)

*G* I am using sendmail, and started off with the old AMaViS mailfilter... by now it's not AMaViS anymore, but yes, it's Linux+sendmail+mySQL+... all the way :)

Before anyone asks: The script isn't ready for prime time yet (too site-specific, lots of things hardcoded, still a few critical bugs), but I am considering to wrap it up and release it someday, although probably not in the near future - it is too embarrassing at the moment ;)

Jens

#3 lore raw
Quoted 10 lines · Jens Knoell
Quoted 5 lines
| It's probably somewhat OT - is there an established procedure for bouncing
| mails? Special headers and the like? A net search wasn't exactly helpful...
| does anyone know a good resource to read up on that?

How and why do you want to bounce email?

How: from a custom, not-yet-totally-finished script that is supposed to filter all incoming mail based on certain per-user conditions in an SQL database.

Quoted 5 lines

The idea is to bounce mails only once per sender per day. So far, I've been using "custom" reply mails, as well as informing the recipient by sending them some tiny email. So far so good - but I'd like to re-format the reply mails to be a little more compliant to standards (if there are any for such things).

Whereabouts in the message delivery chain does the script sit? Does it process the message as it comes in, or is it fed the message after the SMTP server has acknowledged its acceptance?

For the former (e.g. if the script is registered as a mailer in sendmail.cf, or called from a procmail rule), it should simply report a failure via its exit code, so that the SMTP server indicates an error immediately. This eliminates the need to construct a bounce message.

For the latter, then it needs to send a bounce message to the *envelope* sender address; sending bounces to any other address may result in your domain being blacklisted by mailing lists.

As for the format, see RFCs 2822 (Internet Message Format) and 2045-2049 (Multipurpose Internet Mail Extensions). Or just mimic the format of a sendmail-generated bounce message.

Signature · 1 line
Glynn Clements <[email protected]>
#4 lore raw

From: "Glynn Clements" <[email protected]>

Quoted 3 lines

Whereabouts in the message delivery chain does the script sit? Does it process the message as it comes in, or is it fed the message after the SMTP server has acknowledged its acceptance?

It uses the Mlocal part of sendmail's config, so it is possible to use the exit code, as far as I know. But to the best of my knowledge, it's not possible to return some custom string to indicate the reason for failure, is there?

Quoted 5 lines

For the former (e.g. if the script is registered as a mailer in sendmail.cf, or called from a procmail rule), it should simply report a failure via its exit code, so that the SMTP server indicates an error immediately. This eliminates the need to construct a bounce message.

Absolutely - IF I can somehow return a custom error message like "Message appears to be spam - look at http://blah.blubb.bleh/spampolicy.html" or some such...?

Quoted 3 lines

For the latter, then it needs to send a bounce message to the *envelope* sender address; sending bounces to any other address may result in your domain being blacklisted by mailing lists.

That's what I currently do, I think.

Good point about mimicking sendmail's generic error messages... I hadn't thought of doing it that way.

Thanks a lot
Jens

#5 lore raw
Quoted 8 lines · Jens Knoell
Quoted 3 lines

Whereabouts in the message delivery chain does the script sit? Does it process the message as it comes in, or is it fed the message after the SMTP server has acknowledged its acceptance?

It uses the Mlocal part of sendmail's config, so it is possible to use the exit code, as far as I know. But to the best of my knowledge, it's not possible to return some custom string to indicate the reason for failure, is there?

AFAICT, anything which the mailer writes to stderr is included in the error message.

Signature · 1 line
Glynn Clements <[email protected]>