Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I use munin, the monitoring program, to alert me by email when something goes wrong on my server. It sends emails as munin.

Normally, when an email like this is to be delivered on the Internet, when postfix/cleanup is called, it asks trivial-rewrite to do a rewrite, which should append realdomain.tld to incomplete sender address.

It seams it does not, because my Postfix SMTP client then tries to send the email containing the From: munin@thehostname header, which Google doesn't really like:

Jul 22 10:00:15 thehostname postfix/pickup[3167]: 979BD1E447E: uid=110 from=<munin@thehostname>
Jul 22 10:00:15 thehostname postfix/cleanup[9609]: 979BD1E447E: message-id=<20130722080015.979BD1E447E@realdomain.tld>
Jul 22 10:00:15 thehostname postfix/qmgr[3276]: 979BD1E447E: from=<munin@thehostname>, size=454, nrcpt=1 (queue active)
Jul 22 10:00:16 thehostname postfix/smtp[9611]: 979BD1E447E: to=<>, relay=ASPMX.L.GOOGLE.COM[]:25, delay=0.49, delays=0.07/0/0.12/0.3, dsn=5.7.1, status=bounced (host ASPMX.L.GOOGLE.COM[] said: 550-5.7.1 [       1] Our system has detected an unusual rate of 550-5.7.1 unsolicited mail originating from your IP address. To protect our 550-5.7.1 users from spam, mail sent from your IP address has been blocked. 550-5.7.1 Please visit to review 550 5.7.1 our Bulk Email Senders Guidelines. x12si10440172wia.27 - gsmtp (in reply to end of DATA command))
Jul 22 10:00:16 thehostname postfix/cleanup[9609]: 372F91E4483: message-id=<20130722080016.372F91E4483@realdomain.tld>
Jul 22 10:00:16 thehostname postfix/qmgr[3276]: 372F91E4483: from=<>, size=3167, nrcpt=1 (queue active)
Jul 22 10:00:16 thehostname postfix/bounce[9614]: 979BD1E447E: sender non-delivery notification: 372F91E4483
Jul 22 10:00:16 thehostname postfix/qmgr[3276]: 979BD1E447E: removed
Jul 22 10:00:16 thehostname postfix/local[9617]: 372F91E4483: to=<munin@thehostname>, relay=local, delay=0.13, delays=0.05/0.01/0/0.06, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Jul 22 10:00:16 thehostname postfix/qmgr[3276]: 372F91E4483: removed

I don't know why the trivial-rewrite doesn't work as expected for the munin user and why doesn't it get a proper sender address before the email is sent on the internet.

Other programs like fail2ban succeed to send emails and are rewrote to fail2ban@realdomain.tld...

Here is the interesting part of my configuration:

myhostname = realdomain.tld
mydomain = thehostname
mydestination = localhost.localdomain, localhost, $mydomain, $myhostname
myorigin = $myhostname
mynetworks =
relayhost =

I think there must be something I don't understand in the rewrite process!


I found this on an article talking about postfix addresses rewriting.

Rewrite user to user@$myorigin

This feature is controlled by the boolean append_at_myorigin parameter (default: yes). The purpose is to get consistent treatment of user on every machine in $myorigin.

I haven't changed the append_at_myorigin parameter, which should be set "yes". $myorigin is set to realdomain.tld, but the rewriting goes wrong and choose $mydomain instead.

share|improve this question
Are you using procmail? –  ALex_hha Jul 22 '13 at 19:08
Yes I use procmail, but I think this program is only called for local delivery (like for the bounce message which was sent to munin@thehostname). But for the email I'm talking about qmgr gave it to smtp, not to local process. –  Fox Jul 22 '13 at 19:12
I just edited my post to add more information. –  Fox Jul 22 '13 at 20:10

1 Answer 1

From the first log line

Jul 22 10:00:15 thehostname postfix/pickup[3167]: 979BD1E447E: uid=110 from=<munin@thehostname>

we can conclude that munin daemon set sender as munin@thehostname not munin only (without domain part) as your assumption.

As a proof, I send email via sendmail CLI

$ mail
Subject: test

Above command will add queue in queue_directory/maildrop. Run postcat command to view the queue content

$ sudo postcat -q 5A1AD347819 
*** ENVELOPE RECORDS maildrop/5A1AD347819 ***
message_arrival_time: Thu Oct  9 23:02:43 2014
named_attribute: rewrite_context=local
sender_fullname: User
sender: myuser
*** MESSAGE CONTENTS maildrop/5A1AD347819 ***
Subject: test

*** HEADER EXTRACTED maildrop/5A1AD347819 ***
*** MESSAGE FILE END maildrop/5A1AD347819 ***

In this case the sender was only myuser without domain part. Here entry of maillog when sending.

Oct  9 23:05:11 web postfix/pickup[79682]: 9808834784D: uid=1010 from=<zagalo>
Oct  9 23:05:11 web postfix/cleanup[79684]: 9808834784D: message-id=<>
Oct  9 23:05:11 web postfix/qmgr[79683]: 9808834784D: from=<>, size=318, nrcpt=1 (queue active)

So, trivial rewrite has nothing to do in your case. Your email has proper sender address, so it hadn't rewritten.


  • Tell munin to change the sender address (my quick googling didn't provide useful results).
  • As alternative, set smtp_generic_maps to providing the rewrite for your munin.

        smtp_generic_maps = hash:/etc/postfix/generic
        munin@thehostname       munin@realdomain.tld
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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