Send Email From Gmail Using Terminal

I have just completed a project where I needed PCLinuxOS to send e-mails from a php webform using sendmail, took me some time to figure out, and perhaps this can be useful. It can also be used to send e-mails directly from the command line or from scripts.

  1.  install sendmail and sendmail-cf from Synaptic
  2.  create a gmail account, log on to this account and allow less secure login (in the gmail account settings)
  3.  As root – do the following:
create a text password file and name it /etc/mail/authinfo/gmail-auth with this content (replace e-mail address and password -after- the colons):
then create sendmail database map:

Put these lines in your /etc/mail/sendmail.mc configuration – just above the first MAILER definition line:

Then refresh sendmail config:
4) Configure automatic start of sendmail:

Still as root:

Edit the file

and add this line:

then start sendmail service:

Test with:

cheers,
MBantz From PClinuxOS-Forum

 

Photo by cote

 

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Spelling error report

The following text will be sent to our editors: