nixCraft Poll

Topics

Sendmail masquerade outgoing email address

Posted by Vivek Gite [Last updated: November 2, 2006]

If you just need an outgoing email from web server use sendmail. But what is masquerading?

With the help of masquerading your outgoing email appers from user@cyberciti.biz instead of realunixuser@server01.cyberciti.biz. This will also hide your internal user name or host name from rest of the world.

So this feature rewrites the hostname in the address of outgoing mail. This is also used when you have centralized mail server i.e. mail hub.

Sendmail masquerading configuration

Open your sendmail config file /etc/mail/sendmail.mc:
# vi /etc/mail/sendmail.mc
Append/add/modify the lines as follows:
MASQUERADE_AS(cyberciti.biz)dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(cyberciti.biz)dnl

Save and close the file. Replace domain name cyberciti.biz with your actual domain name. Update and restat sendmail server:
# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
# /etc/init.d/sendmail restart

Further reading

=> Masquerading and relaying

Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

You may also be interested in other helpful articles:

Discussion on This Article:

  1. didier Says:

    Nice. So, this explains how to ‘hide’ the domain name. But what about the user name ? With the changes you describe, it still shows our real unix username. Am I missing something here ?

    thanks for your help.
    -Didier

  2. nixcraft Says:

    Do you have virtual UNIX user name mapping like:
    user1@domain.com drealuser

    ???

  3. didier Says:

    Hi nixcraft,

    No I haven’t set this up. To be fully honest, I am not familiar with virtual unix user name mapping. Can you explain a little bit more.

    I did try to use the virtusertable file but it didn’t to work for outgoing email. The problem I am trying to solve is EXACTLY the on you mention in your post: I have a machine (prod1) and a user (prod) and I want to send emails as invitation@.com (I am just interested in outgoing email… and no, I am not a spammer :-)

    The masquerade works for the domain name, but for the user, I ended up having to create a unix user ‘invitation’ on my box and sudo to invitation before sending the emails… It works fine but I am sure there is a better/simpler way…

    Thanks for your reply btw.
    -Didier

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.