Handling Rejection - Sendmail

Posted on 2008-02-10
Medium Priority
Last Modified: 2013-12-17
I was wondering how I can change sendmails behavior with respect to handling rejection.

For instance sometimes my servers mail gets rejected by yahoo (and others) due to "spam" or other reasons.  Instead of having those messages immediately returned to sender with a rejection notice I would like the messages to be queued for rescanning and perhaps for redirecting to be sent out through another non blocked mail server.

Here is an example

Feb  9 19:25:58 ob1 sendmail[31097]: m1A3Pp4W031084: to=<xxxxxxxx@comcast.net>, delay=00:00:07, xdelay=00:00:00, mailer=esmtp, pri=129858, relay=mx1.comcast.net. [], dsn=5.0.0, stat=Service unavailable
Feb  9 19:25:58 ob1 sendmail[31097]: m1A3Pp4W031084: m1A3Pw4W031097: DSN: Service unavailable

This message was bounced by comcast because the server was temporarily blacklisted with a message to the sender notifying them of the same.     I would like to change sendmails default response to dsn=5.0.0 errors so that the message is not immediately returned to sender but queued for rescanning and submission through a non blocked mailler.


Apologies if there is an obvious answer to this. I have searched high and low for about two weeks.
Question by:mplangley
  • 2

Expert Comment

ID: 20864255
I suggest you check out this page (Especially under the section Access Database):


LVL 34

Expert Comment

ID: 20872324
I don't think there's a handy way to do this.

Offhand, I can't think of any configuration item that would address this need. I *think* to do what you want you'd have to hack the code directly. Probably somewhere in smtpsrvr.c.

Author Comment

ID: 21381113
Thanks PsiCop - did you mean srvrsmtp.c?

Regarding /etc/mail/access (hbustan above) it would not be invoked after mail had been attempted to the recipient server so I couldnt see how it would handle mail that was rejected by the recipient server.

What I would like to have is a method whereby when a recipient server rejects the mail in question my sending server tries the same recipient but through a different sending server.

In otherwords if my sending server 1 is blocked by recipient server Id like to have another go at it via my sending server 2.  So I would like to have the rejected mail sent by sending server 1 to sending server 2 where it is retried.

LVL 34

Accepted Solution

PsiCop earned 2000 total points
ID: 21382163
Whoops. Yes, I did.

As for what you want to do, having Server 1 hand off an E-Mail to Server 2 when Server 1 encounters a rejection.... hmmm....

That can get gnarly quick. I can think of a way to approach it using a MILTER. For example, MIMEDefang (http://www.mimedefang.org) has a function that will check to see if an SMTP host will accept E-Mail for a particular recipient. It's not foolproof, tho....

Anyway, if you used it, and it worked the way you wanted, you could then use another MIMEDefang function to re-queue the E-Mail for delivery thru Server 2 (possibly by using multiple mail queues with a specific SmartHost (Server2) defined for all E-Mail in one particular queue.

I've never done anything like that...I'm not sure how practical it is. I *think* it would work, tho. And it's the only idea that comes to mind right now.

Perhaps someone else will have something better.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One-stop solution for Exchange Administrators to address all MS Exchange Server issues, which is known by the name of Stellar Exchange Toolkit.
Steps to fix error: “Couldn’t mount the database that you specified. Specified database: HU-DB; Error code: An Active Manager operation fail”
In this video we show how to create a Shared Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Sha…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
Suggested Courses

594 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question