Change sender address of queued mails

Is it possible to change the sender address of mails that are already queued?

The relay-server we've used so far has silently changed its policy a few days ago and rejects now mails without a verified sender address. We've now adapted sendmail's settings but a few mails with the old sender address are already stuck in the queue (Sender address rejected: unverified address). Can I change their sender address?


Look in /var/spool/mqueue. There are two files for each mail. dfblah for the email text, qfblah for the headers. You can ignore the df files and concentrate of the qf files. Depending on whether you need to modify just the envelope-from or the header-from as well, you might need to modify one or two locations.

Save a copy before you start modifying these files. Kill sendmail too to avoid lock/race problems.


Sendmail stores queued messages as text files, so this should be possible; howewer, the format of the queue files is somewhat complex (as everything in Sendmail...), so modifying them by hand is probably not so trivial.

Lots of info here:

http://osr507doc.sco.com/en/MailMsgG/sndmlT18.html
http://www.unixmexico.org/files/html/kore.hack.se/oreilly/networking/sendmail/ch23_02.htm
http://www.unixmexico.org/files/html/kore.hack.se/oreilly/networking/sendmail/ch23_09.htm