Pages

Friday, 28 June 2013

Configure Sendmail as SMTP Mail Client

Configuration

Step # 1: Disable Sendmail Daemon In a Listing Mode

# vi /etc/sysconfig/sendmail

Modify the line:
DAEMON=no
 

Step #2: Configure Mail Submission

# vi /etc/mail/submit.cf 
 
D{MTAHost}<smtp.mailserver.com>


Sending Emails With Sendmail

SMTP Headers File  

<e.g /tmp/mail.txt>
From: "Me" <jxx_1@mail1.com>
To: "jxx_1@mail1.com" <jxx_1@mail1.com>
Subject: First Email
MIME-Version: 1.0
Content-Type: text/plain

Hello, World!
.

Send Email

cat /tmp/mail.txt | sendmail -i -t

-t tells sendmail that the message contains all the information it needs to send an email, i.e. the To: and From: fields, etc. Otherwise it's going to expect you to pass them as arguments on the command line.
-i tells sendmail that we're piping the message in from a file, so it should ignore the single-period requirement and expect an EOF instead. If you don't pass this argument when piping a file, then sendmail will expect a lone period at the end of your message file.
 
Source: 

No comments:

Post a Comment