After running postqueue -p i sometimes finds misspelled email-adresses,
is there a way to change the reception adress (envelop to adress) of the messages,
so it can be delivered.


postqueue -p
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
A78C42189B1     2523 Thu Jul 25 14:53:57  xxxx@xxxx.se
                (connect to tellia.com[]:25: Connection timed out)
-- 2 Kbytes in 1 Request.

I want to pick upp A78C42189B1, and change the adress yyyyy@tellia.com to yyyyy@telia.com

  • Looking for something like this too. I often see common misspelled stuff like "homail.com" or "hotmai.com".
    – Henk
    Jul 31, 2013 at 14:41
  • if you always want to rewrite a domain, you can use recipient_canonical_maps, i use it whit mysql-query SELECT CONCAT('%u', '@', real_domain) FROM domains WHERE domain = '%d'
    – Puggan Se
    Jul 31, 2013 at 14:56

2 Answers 2


So far i found out i can:

  1. using postcat -q A78C42189B1 i can get a copy of the queued item
  2. clean the message from meta data, the postcat messages may look like:

    *** ENVELOPE RECORDS deferred/A/A78C42189B1 ***
    message_size:            2523             248               2               0            2523
    message_arrival_time: Thu Jul 25 14:53:57 2013
    create_time: Thu Jul 25 14:53:57 2013
    named_attribute: rewrite_context=local
    sender_fullname: nobody
    sender: FROM:xxxx@xxxx.se
    original_recipient: yyyyy@tellia.com
    recipient: yyyyy@tellia.com
    *** MESSAGE CONTENTS deferred/A/A78C42189B1 ***
    mail headers...
    mail body...
    *** HEADER EXTRACTED deferred/A/A78C42189B1 ***
    named_attribute: notify_flags=1
    original_recipient: backup@xxxx.se
    done_recipient: backup@xxxx.se
    *** MESSAGE FILE END deferred/A/A78C42189B1 ***

    Clean out the postfix header and footer, so only mail headers and mail body is left in the file, using a text editor, or sed.

  3. use sendmail to send the mail to the new reciption

    sendmail yyyyy@telia.com < edited_mail_file
  4. remove the original mail from the queue postsuper -d mailID

if someone with sed-skills, can cut out the mail header and body, the 3 first steps should be able to pipe togheter


Yes, your described method is working with mail stuck in the mailqueue.

Though not really an answer to your specific issue, I'd like to share what I did to (re)solve some common misspelled domain-names in the future, using your hint:

In postfix/main.cf:

recipient_canonical_maps = regexp:/etc/postfix/maps/recipient_canonical

File /etc/postfix/maps/recipient_canonical:

/^(.*@)htomail.com$/ ${1}hotmail.com
/^(.*@)homail.com$/ ${1}hotmail.com
/^(.*@)hotmai.com$/ ${1}hotmail.com
/^(.*@)hotmai.co$/ ${1}hotmail.com
/^(.*@)hotma.com$/ ${1}hotmail.com
/^(.*@)gmial.com$/ ${1}gmail.com
/^(.*@)gmail.co$/ ${1}gmail.com
/^(.*@)gmail.nl$/ ${1}gmail.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.