Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

First, here are the entries I added/modified in /etc/postfix/main.cf file:

mydomain = domain.com
myorigin = $mydomain
relayhost = email-smtp.us-east-1.amazonaws.com:25
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl/amazon-ses
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_use_tls = yes
smtp_tls_security_level = encrypt
smtp_tls_note_starttls_offer = yes
header_checks = regexp:/etc/postfix/header_checks

Now, if I send a test mail like so...

$ sudo sendmail someone@gmail.com
To: someone@gmail.com
From: noreply@domain.com
Subject: Test email!
This is just a test email.

and check the mail log (/var/log/mail.log), I see this:

Feb 17 04:23:16 hostname postfix/pickup[6226]: B3DD4137ED: uid=0 from=<root>
Feb 17 04:23:16 hostname postfix/cleanup[6230]: B3DD4137ED: replace: header From: noreply@domain.com from local; from=<root@domain.com> to=<someone@gmail.com>: From: "WebsiteName Alerts (no reply)" <noreply@domain.com>
Feb 17 04:23:16 hostname postfix/cleanup[6230]: B3DD4137ED: message-id=<20130217042316.B3DD4137ED@hostname.domain.com>
Feb 17 04:23:16 hostname postfix/qmgr[6144]: B3DD4137ED: from=<root@domain.com>, size=353, nrcpt=1 (queue active)
Feb 17 04:23:18 hostname postfix/smtp[6232]: B3DD4137ED: to=<someone@gmail.com>, relay=email-smtp.us-east-1.amazonaws.com[]:25, delay=25, delays=24/0.03/0.93/0.58, dsn=2.0.0, status=sent (250 Ok 0000013ce6644ae6-69927d25-c4e1-4f25-8ad4-b85b59318e84-000000)
Feb 17 04:23:18 hostname postfix/qmgr[6144]: B3DD4137ED: removed

As you can see, the log shows both root@domain.com and noreply@domain.com as from even though I specifically stated noreply@domain.com in the sendmail command.

That too, despite modifying my /etc/aliases file like so:

# /etc/aliases
mailer-daemon: noreply@domain.com
postmaster: noreply@domain.com
nobody: noreply@domain.com
hostmaster: noreply@domain.com
usenet: noreply@domain.com
news: noreply@domain.com
webmaster: noreply@domain.com
www: noreply@domain.com
ftp: noreply@domain.com
abuse: noreply@domain.com
noc: noreply@domain.com
security: noreply@domain.com
root: noreply@domain.com

So, the question is, how do I make noreply@domain.com the default email address-out for the system? Put it the other way, how do I change the email address of root user from root@domain.com to noreply@domain.com?

In case this matters, my system's running Debian 7 (Wheezy) 64-bit.

share|improve this question
up vote 3 down vote accepted

There is no default return e-mail address other than the user name combined with domain name. As you invoke the sendmail with sudo, it uses the root user name to make the envelope return address. To change this behavior use the -f switch with sendmail:

   -fname Sets the name of the ``from'' person (i.e., the envelope  sender
          of the mail).  This address may also be used in the From: header
          if that header is missing during initial submission.  The  enve‐
          lope sender address is used as the recipient for delivery status
          notifications and may also appear in a Return-Path: header.   -f
          should only be used by ``trusted'' users (normally root, daemon,
          and network) or if the person you are trying to  become  is  the
          same  as  the  person  you are.  Otherwise, an X-Authentication-
          Warning header will be added to the message.
share|improve this answer
Maybe you didn't understand my question. When I send the mail, and the email is received at the other end, I do see that the email is sent by noreply@domain.com itself. The thing is, the mail.log shows that the root@domain.com for from is internally replaced with noreply@domain.com before the email is sent. Or does it mean that the root user passes on the email from root@domain.com locally to noreply@domain.com for the latter to send it? Am I clear? – its_me Feb 17 '13 at 5:41
I am sorry, not really. You typed in the From: header already containing noreply@domain.com address at submission. The From: header and the envelope from address is not the same thing. Please check the Return-Path: header in the headers of the received e-mail. This address will be used to return any Delivery Status Reports when delivery fails, not the address in the 'From:' header. – Serge Feb 17 '13 at 6:00

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.