Handling Rejection - Sendmail

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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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


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.
mplangleyAuthor Commented:
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.

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Servers

From novice to tech pro — start learning today.