SENDMAIL Configurations

SMTP relay will also check the source of sender by using ping-back. Thus, the servername “webserver.cafecenter.com” must have:
 
– A (HOST) record with updated IP Address, currently 71.189.229.200
– MX (Mail Exchange) record pointing to cafecenter.dyndns.org
 
Also, this line must also be updated as:
vim /etc/mail/authinfo
 
Edit this line ==> AuthInfo:outbound.mailhop.org “U:xkdoan” “P:password” “M:SSL”
 
 
Notice: there is no <xkdoan> and no <password>
 

1. configure your smtp-server

(this requires that you have the package sendmail-cf installed)

1.1. changes to /etc/mail/sendmail.mc

Uncomment the definition SMART_HOST and add the corresponding FEATURE to it:
define(`SMART_HOST’, `outbound.mailhop.org’)
FEATURE(authinfo)dnl
Note: Please note, that these are “oriented” quotes.

1.2. create the new sendmail.cf

Stop sendmail by issuing the command
/sbin/service sendmail stop
 
and log on as root to issue this command.
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

1.3. Define the account information for connecting to the smtp-server

Edit/create /etc/mail/authinfo and add the following line:
AuthInfo:<smtpout.secureserver.net> “U:<admin@cafecenter.com>” “P:<password>” “M:SSL”
Note:The M: may vary depending on the capabilities of the smtp-server (e.g. CRAM-MD5, PLAIN).
 
Create authinfo.db:
makemap hash /etc/mail/authinfo < /etc/mail/authinfo
and finally restart sendmail:
/sbin/service sendmail restart

1.4. Configure header rewriting (optional)

Header rewriting consists in replacing the From: and Reply to: in the header of an outgoing mail in order for the recipient to reply to a valid address.
This can be set by editing the file /etc/mail/userdb:
<local-name>:mailname <email-adsress>
E.g.:
# /etc/mail/userdb
sven:mailname sven@foo.org
Finally create the corresponding database:
makemap btree /etc/mail/userdb.db < /etc/mail/userdb
… and finally restart sendmail:
/sbin/service sendmail restart

1.5. Test your settings

Issue following commands and check the trace for verifying the delivery path:
/usr/sbin/sendmail -bv root@localhost Should show a “local” delivery.
/usr/sbin/sendmail -bv admin@cafecenter.com Should show a delivery path through your ISP.
 
For troubleshooting you should check the mail-log: /var/log/maillog

2. Forwarding

Forward can be defined in ~/.forward. (just enter the e-mail addressto forward to). Note:The permissions of that file must be adjusted correspondingly in order to avoid sendmail ignoring it (see /var/log/maillog in case of problems).
 

Sendmail

Sendmail configuration is not for the faint of heart. Debugging and diagnosis can be even harder, at times. We provide the instructions below, but they gloss over some of the major configuration management issues inherent to Sendmail, and we cannot assist you with those issues. We strongly recommend Exim as an alternative UNIX SMTP server.
These instructions assume that you already have an appropriate .mc file prepared for your Sendmail configuration, and have the appropriate commands/tools prepared to compile that into a sendmail.cf file and install it in the appropriate location. On some BSD-based systems, this is as simple as typing “make” in /etc/mail and editing $hostname.mc. On other systems, it can be considerably more difficult. Consult the manual for your system or Sendmail for more information.
  1. Add the following lines to your .mc file:
    FEATURE(authinfo, `hash -o /etc/mail/authinfo’)
    define(SMART_HOST, outbound.mailhop.org)
    If you need to use an alternate port (other than 25) for MailHop Outbound, also add the following line:
    define(RELAY_MAILER_ARGS, `TCP $h 2525′)
    You may also use port 10025 or any other standard SMTP port that we offer for the MailHop Outbound service in the above line, in place of “2525”. You should NOT use the SMTPS port(s) we offer.
  2. Create or edit the file /etc/mail/authinfo, and add a line that looks like this:
    AuthInfo:outbound.mailhop.org “U:username” “P:password” “M:LOGIN”
    Replacing “username” and “password” with your DynDNS username and password, respectively. Be sure to include the rest of the line exactly as it is shown above, quotes and all. You should make sure that this file is not readable by unpriviledged users, as it contains your login information.
  3. Build the authinfo file into the Sendmail hash database format with the following command:
    makemap hash /etc/mail/authinfo < /etc/mail/authinfo
    This will create an /etc/mail/authinfo.db file, which Sendmail will use to read the authentication information. You will need to re-run the above command any time you change /etc/mail/authinfo.
  4. Finally, compile your .mc file to a .cf file, install it as sendmail.cf , and re-start Sendmail. Your server should now send all mail via the MailHop Outbound server!
—————————————————————-
May also use stmp.gmail.com port 587
 
Read Root Emails:
cat /var/spool/mail/root
 
Remove mails from Root
rm /var/spool/mail/root
 
———————————————————–

Compiling sendmail.mc

Sendmail’s configuration files are written in a macro language known as M4. This gives them a great deal of configurability (arguably more so than any other MTA), but makes them very complicated and hard to “get right”.
Once you have configured sendmail.mc to your liking, you must compile it down to sendmail.cf. There are a number of ways to do this, and depending upon who you ask you may get wildly different answers, but I usually prefer the following:
First, I compile the sendmail.mc file to a temporary file:
# m4 sendmail.mc > _sendmail.cf
I do this to prevent accidentally breaking Sendmail’s functionality during the compile. After this, I simply move the temporary file onto the permanent one:
# mv _sendmail.cf sendmail.cf
This is typically a pretty safe thing to do, and should not disrupt a running Sendmail system.
Posted on Categories Linux

Leave a Reply

Your email address will not be published. Required fields are marked *