Sendmail DSN message tweaking

Go to solution
Todd Everett
New Member

Sendmail DSN message tweaking

I am trying to find where to tweak the information (i.e., dsn mail) when a Sendmail QueueWarn or QueueReturn_DSN occurs.
Does anyone know where to change the text and variables provided in the message back to the sender?

Honored Contributor

Re: Sendmail DSN message tweaking


There is no simple configuration method
to customize MTA errors.

One way is to introduce your own rulesets.
An example from my own metaconfig

R$* $: $(isASCII $1 $: $)
R $@ OK
R$* $#error $@ 5.6.1 $: "554 8bit data not allowed in headers (RFC 2822, section 2.2)"

The customised messages that are easily done
are via access tables but they are not really related to queue warnings. Here is one
line from my own Linux server at home
("" is actually very
heavily used by spammers): ERROR:550 Anti-spamming policy triggered. Security audi
t of your activities will be reported to Federal agencies. Bye bye!

Otherwise, for other customized messages,
you would probably need to change the source

For example, download Sendmail sources, go
to subdirectory named "sendmail" and
there you will find files like

and so on

In other words, the directory for the
latest version of Sendmail might look like:


It all depends on what condition causes
MTA warnings.

They all contain various error messages.
For example, in srvrsmtp.c, you have the
following define:

#define MSG_TEMPFAIL "451 4.3.2 Please try again later"

or, these statements:

message("454 4.5.4 Internal error: unable to encode64");
message("421 4.7.0 %s Too many bad commands; closing connection",
usrerr("452 4.4.5 Insufficient disk space; try again later");
usrerr("454 4.3.0 Please try again later");
message("454 4.5.4 Temporary authentication failure");
message("454 4.3.3 TLS not available after start");
usrerr("454 4.7.0 Please try again later");
message("454 4.3.3 TLS not available: error generating SSL handle");
message("454 4.3.3 TLS not available: error set fd");

I think you get the idea...


VK2COT - Dusan Baljevic
Michael Steele_2
Honored Contributor

Re: Sendmail DSN message tweaking


And you, vk2cow should not be answering sendmail questions. You are providing procedure that do not exist. You are providing file references that do not exist. THIS NOT LINUX.


You find your QueueWarn or QueueReturn_DSN in the /etc/mail/ file. I.e.,

"...CONFIG: New options confTO_QUEUERETURN_DSN and confTO_QUEUEWARN_DSN to control queue return and warning times for delivery status notifications...."

After you modify the file you stop / start the daemon.
Support Fatherhood - Stop Family Law
Honored Contributor

Re: Sendmail DSN message tweaking

Hello Michael,

I am surprised by the harshness of your tone.

a) Sendmail is not Linux owned. Never was
and never will.

Sendmail is an open-source Mail Transfer
Agent (albeit, there is a commercial version

b) I answered the question for three reasons:

1. Anybody can grab the sources and
compile them on HP-UX too. There is
nothing wrong about it :)

So, there is a way to modify the

2. You are very wrong about configuration
parameters in Sendmail:

O Timeout.queuewarn.normal=4h
O Timeout.queuewarn.urgent=1h
O Timeout.queuewarn.non-urgent=12h
O Timeout.queuewarn.dsn=4h

They define TIMES not the messages! The
question in the thread was not related to customisation of the times but the
contents of the messages they send back
to senders!

3. It is good for others to learn various
tricks with MTA. Consider it to
be a reference to for someone else.

c) My radio amateur radio call-sign is not
vk2cow, but vk2cot :)

Ahh, let's not start 2010 with harsh
words. There is enough of them in the real
world as it is. I know, I was in the forces
in my old days.

Be happy,

VK2COT (25 years in Unix, VMS, and Linux
and counting...)
VK2COT - Dusan Baljevic
Michael Steele_2
Honored Contributor

Re: Sendmail DSN message tweaking

vk2cow should not be answering sendmail questions in hp-ux

this is not linux

we are not here to read about linux or share what your knowledge is regarding linux

And if you don't understand the differences in HP-UX sendmail and Linux then you should take a class.
Support Fatherhood - Stop Family Law
Todd Everett
New Member

Re: Sendmail DSN message tweaking

VK2COT: Thank you for the help. I am obviously a Sendmail newbie here, so sorry for the basic questions.

I checked in my working and template files and do not see:

What I am really trying to do is the following:
Sendmail by default sends 1 queuewarn message and then 1 queuereturn message. I need to generate 3 queuewarn messages over a period before the queuereturn.
What I was hoping to do was to find a way to pull the original message out of the queuewarn(1) and send it off with a new X-Header to mark it so that I would get:
original email
queuewarn (original)
email (2)
queuewarn (2)
queuereturn (original)
queuereturn (2)

Yes, I realize that would be sending 2 copies of the email if the original queued once...

Any ideas on how to do this or a better approach?

Thank you very much.
Happy New Year!

Honored Contributor

Re: Sendmail DSN message tweaking

Hello Todd,

Interesting question and unusual requirement.

Do not worry about asking it. We all learn
every day. After 25 years in Unix/Linux I
still consider myself to be a "beginner".

Welcome to the ITRC Forums and I hope
you will have good experiences. There are
some very knowledgeable, polite and
helpful people in them.

Who am I and what I do is here:

a) To add customised X-Headers is easy.
Here is an example from my own

HX-MyCompany-1: The message passed MyCompany MTA.
HX-MyCompany-2: These headers warrant that this is
HX-MyCompany-3: MyCompany Compliant Message and not spam.
HX-MyCompany-4: If you suspect any wrongdoings
HX-MyCompany-5: please notify abuse@mycompany.dom.

b) X-Headers are user-defined, unofficial
message header fields that exist in the
message header. X-Headers are not
specifically mentioned in RFC 2822, but the
use of an undefined message header field
starting with "X-" has become an accepted
way to add unofficial message header fields
to a message. In other words, there are no
correct syntax, as X-headers are unofficial.

c) One idea just came to me. It needs to be fully tested but I think it should work.

If messages in the queue are undeliverable,
one could copy or move them into another queue and that way "duplicate" them.

Then, via simple sed, Perl, or awk
script, one could manipulate the messages
in that queue and add whatever headers...

Something like this:

1. Create a new mail queue:

# cd /var/spool

# mkdir myqueue2

# chmod 0700 myqueue2

2. Create a new sendmail config, where you
simply change the mail queue directory:

# cp /etc/mail/ /etc/mail/

# diff /etc/mail/ /etc/mail/

< O QueueDirectory=/var/spool/mqueue
> O QueueDirectory=/var/spool/myqueue2

3. Copy the messages in the deferred queue:

# cp -p /var/spool/mqueue/* /var/spool/myqueue2

Make sure that your qf and df unique
numbers are changed in myqueue2 directory.
Otherwise, Sendmail will not process
the messages! Something like this:

# cd /var/spool/myqueue2/
# mv dfo02MkveL023825 dfo02MkveL023829
# mv qfo02MkveL023825 qfo02MkveL023829

You can also modify the messages anyway you want (add headers, change them, and so on).

4. Then:

# chgrp smmsp /var/spool/myqueue2/df* /var/spool/myqueue2/qf*

5. Finally, run this queue:

# /usr/sbin/sendmail â C /etc/mail/ â q

There are no silly questions, just silly answers :)


VK2COT - Dusan Baljevic