Sunday, December 25, 2011

Setup and Configure Sendmail Server

Hello Everyone,
After verifying connectivity, DNS, and telnet to smtp, it is right time to configure your Sendmail server. To enable masquerading and binding your domain for sendmail, you should change the sendmail configuration file which is located in /etc/mail/sendmail.mc. Open this file with vi and change the following lines:
change:
LOCAL_DOMAIN(`localhost.localdomain')dnl     to     LOCAL_DOMAIN(khosro.org)dnl
dnl MASQUERADE_AS(`mydomain.com')dnl      to   MASQUERADE_AS(khosro.org)dnl
dnl FEATURE(masquerade_envelope)dnl            to   FEATURE(masquerade_envelope)dnl
dnl FEATURE(masquerade_entire_domain)   to FEATURE(masquerade_entire_domain)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl   to MASQUERADE_DOMAIN(khosro.org)dnl

Replace khosro.org with your domain name.
Now, you should run the following command in order to take effect your change in configuration file. You should use m4 command like this:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
Now, restart your sendmail with this command:    service sendmail restart
If everything is fine, you should able to send an email. Create a file and put some text on this file. Name this file to message_file. Run this command in order to send an email to your friend.

mail -v -s "Test from Khosro" root@mymachine.khosro.org < message_file

Change mymachine.khosro.org to your machine name and domain name. Use mail command to check the inbox and verify your email that you already sent it.  
Please leave your comments or questions. I will try to answer as soon as possible.
Thanks,
Khosro Taraghi

No comments:

Post a Comment