I was using mail command to send mail from the command line. However, my from address was coming as username@hostname and my mail server was not accepting this mail. I searched google for solutions but none worked for me. So atlast this is what I did.
1. Installed sendmail using "sudo apt-get install sendmail"
2. Install mailutils - "sudo apt-get install mailutils"
2. sudo vim /etc/mail/sendmail.mc
3. Changed the parameter "MASQUERADE_AS"
MASQUERADE_AS(`mydomain.com')dnl
4. Run "sudo sendmailconfig"
5. Now sent mail using
echo "this is mail body" | mail -s "this is test " sabu@mydomain.com
My last few lines of sendmail.c looks like :-
include(`/etc/mail/m4/dialup.m4')dnl
include(`/etc/mail/m4/provider.m4')dnl
dnl #
dnl # Default Mailer setup
dnl # Masquerading options
FEATURE(`always_add_domain')dnl
MASQUERADE_AS(`mydomain.com')dnl
FEATURE(`allmasquerade')dnl
FEATURE(`masquerade_envelope')dnl
MAILER_DEFINITIONS
MAILER(`local')dnl
MAILER(`smtp')dnl
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment