CyberKeeda In Social Media

How to send emails from Linux terminal and shell scripts using GMAIL



GMAIL SMTP Configuration on Linux Box.


Video Tutorial.



###########  Use GMAIL SMTP server to send mails ##################


# yum install -y mailx

Lets tell google we gonna send emails from other devices also.

https://myaccount.google.com/lesssecureapps

Edit

# vim /etc/mail.rc

#----------- add the below lines and append as per your credentials.


set smtp=smtps://smtp.gmail.com:465
set smtp-auth=login
set smtp-auth-user=USERNAME@YOURDOMAIN.COM
set smtp-auth-password=YOURPASSWORD
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb/

Update the gmail account credentails over here and save

# Now we are all done , we will be using gmail to send email from our linux box.

echo "Relay Test" | mail -v -s "Relay test" anyworkingemailid@anydomain.com

anyways...  you send it to multiple domains now..

Rememeber ... From email id will be the same that you have configured within /et/mail.rc file

# Thanks


No comments:

Post a Comment

Designed By Jackuna