sendmail or sending mail

If you want to use sendmail so that you can send all your mails from the local system to your email address, then you have to use sendmail.  Now, configuring sendmail has never been that easy and if you are working internally on your corporate network then for sending mails to the same domain, generally you don’t have to login. That being the case, you can use something simpler like “sstmp“. Install ssmtp with:

sudo yum install ssmtp

and then just open the file “/etc/ssmtp/ssmtp.conf”, change the email address, and you should be done. If your mail host is not reachable as “mail“, then you might need to change mailhub. Just check the alternatives with “galternatives” to make sure that mta/sendmail alternative default is set to “ssmtp“.

 

Enhanced by Zemanta

Using ssmtp to send mail using gmail.

First install the package ssmtp using the command:

1
sudo yum install ssmtp

Open the configuration file for ssmtp as root user:

1
vim /etc/ssmtp/ssmtp.conf

Make the following changes to the configuration file:

root=username@gmail.com
mailhub=smtp.gmail.com:587
hostname=username@gmail.com
UseSTARTTLS=YES
AuthUser=username
AuthPass=password
FromLineOverride=yes

In order to make the default (root) “from” field be the server name,
edit the /etc/ssmtp/revaliases file as root user :

1
vi /etc/ssmtp/revaliases

And add into it the desired translation which in our Gmail examples case
will be:

root:[email protected]:smtp.gmail.com

and time to test:

1
echo "Amit Agarwal"|ssmtp <email id>

If this does not work, then you can try with -v or -vv or -vvv for ssmtp command.

Enhanced by Zemanta

swaks – Swiff army nife for SMTP

If you are having issues with the SMTP Server, then sometimes you just wish you had a swiss army knife to test the same and then you would not have to spend your precious time on some silly mistake that you may have made. Your wish is now fulfilled.

Swiss Army Knife SMTP: A command line SMTP tester.  Swaks can test various aspects of your SMTP server, including TLS and AUTH.

swaks can be easily installed with :

sudo yum install swaks

To begin with, if you want to test the localhost then simply enter swaks, you will be asked for \”to\” address. And then there will be a attempt to send the mail. And you can see the messages on the console. Here\’s an example:

To: =========================
=== Trying localhost:25…
=== Connected to ===============.
<-  220 amit.themafia.info ESMTP Exim 4.69 Sun, 07 Mar 2010 10:24:25 +0530
-> EHLO amit.themafia.info
<-  250-amit.themafia.info Hello
======================
<-  250-SIZE 52428800
<-  250-PIPELINING
<-  250-STARTTLS
<-  250 HELP
-> MAIL FROM
:===========================
<-  250 OK
-> RCPT TO
:================
<-  250 Accepted
-> DATA
<-  354 Enter message, ending with \”.\” on a line by itself
-> Date: Sun, 07 Mar 2010 10:24:25 +0550
-> To:=====================
-> From: ===================================
-> Subject: test Sun, 07 Mar 2010 10:24:25 +0550
-> X-Mailer: swaks v20061116.0 jetmore.org/john/code/#swaks
->
-> This is a test mailing
->
-> .
<-  250 OK id=1No8VV-0003bT-EC
-> QUIT
<-  221 amit.themafia.info closing connection
=== Connection closed with remote host.

For my own security, I have removed my email address and other things. Now, coming to other things.

Here are few of the options that you may find useful

-s ==> server

-f ==> from

-t ==> to

-l ==> input file

-d ==> data

–attach

-h ==> header

–protocol

HELO            AUTH    TLS     PORT
————————————————–
SMTP    HELO                            smtp  / 25
SSMTP   EHLO->HELO              -tlsc   smtps / 465
SSMTPA  EHLO->HELO      -a      -tlsc   smtps / 465
SMTPS   HELO                    -tlsc   smtps / 465
ESMTP   EHLO->HELO                      smtp  / 25
ESMTPA  EHLO->HELO      -a              smtp  / 25
ESMTPS  EHLO->HELO              -tls    smtp  / 25
ESMTPSA EHLO->HELO      -a      -tls    smtp  / 25
LMTP    LHLO                            lmtp  / 24
LMTPA   LHLO            -a              lmtp  / 24
LMTPS   LHLO                    -tls    lmtp  / 24
LMTPSA  LHLO            -a      -tls    lmtp  / 24

You can check other options in the man page or the help.

\"Reblog