Rabu, 10 Agustus 2016

How To Ship E-Mail From Gmail E-Mail's Trouble Organization Human Relationship From Ascendence Linux Centos

This is how to blog, Send Email from your External Email describe organisation human relationship i.e. G-mail address. Linux machine ascendancy or lay it into Shell Script.


Requirement - 

1- One  Linux Machine (Centos 6.x)
2- One  G-Mail account.

Step ane -

Download Epel repository as well as install it.

[root@cent backupdir]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

[root@cent backupdir]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm --2016-08-10 16:04:29--  http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm Resolving dl.fedoraproject.org... 209.132.181.27, 209.132.181.24, 209.132.181.23, ... Connecting to dl.fedoraproject.org|209.132.181.27|:80... connected. HTTP asking sent, awaiting response... 200 OK Length: 14540 (14K) [application/x-rpm] Saving to: “epel-release-6-8.noarch.rpm”  100%[==================================================================================>] 14,540      14.2K/s   inwards 1.0s  2016-08-10 16:04:37 (14.2 KB/s) - “epel-release-6-8.noarch.rpm” saved [14540/14540]  

Install parcel using rpm command

[root@cent backupdir]# rpm -ivh epel-release-6-8.noarch.rpm warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, fundamental ID 0608b895: NOKEY Preparing...                ########################################### [100%]    1:epel-release           ########################################### [100%] [root@cent backupdir]# 

Step 2 -

Install Ssmtp package using yum command.
[root@cent backupdir]# yum install ssmtp Loaded plugins: fastestmirror Setting upward Install Process Loading mirror speeds from cached hostfile epel/metalink                                                                                                                                                         | 3.8 kB     00:00  * base: mirrors.vhost.vn  * epel: epel.mirror.angkasa.id  * extras: mirrors.vhost.vn  * updates: mirrors.vhost.vn epel                                                                                                                                                                  | 4.3 kB     00:00 epel/primary_db                                                                                                                                                       | 5.9 MB     00:39 Resolving Dependencies --> Running transaction cheque ---> Package ssmtp.x86_64 0:2.61-22.el6 volition hold out installed --> Finished Dependency Resolution  Dependencies Resolved  =============================================================================================================================================================================================  Package                                     Arch                                         Version                                           Repository                                  Size ============================================================================================================================================================================================= Installing:  ssmtp                                       x86_64                                       2.61-22.el6                                       epel                                        53 k  Transaction Summary ============================================================================================================================================================================================= Install       ane Package(s)  Total download size: 53 k Installed size: 96 k Is this ok [y/N]: y Downloading Packages: ssmtp-2.61-22.el6.x86_64.rpm                                                                                                                                          |  53 kB     00:00 warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, fundamental ID 0608b895: NOKEY Retrieving fundamental from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 Importing GPG fundamental 0x0608B895:  Userid : EPEL (6) <epel@fedoraproject.org>  Package: epel-release-6-8.noarch (installed)  From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 Is this ok [y/N]: y Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Warning: RPMDB altered exterior of yum.   Installing : ssmtp-2.61-22.el6.x86_64                                                                                                                                                  1/1   Verifying  : ssmtp-2.61-22.el6.x86_64                                                                                                                                                  1/1  Installed:   ssmtp.x86_64 0:2.61-22.el6  Complete! 


Step iii - 

Enable required changes inwards ssmtp.conf file
[root@cent backupdir]# vi /etc/ssmtp/ssmtp.conf 

Made highlighted changes inwards your ssmtp.conf file every bit below. as well as append 2 describe if doesn't exist.
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt
USESTARTTLS=YES


# /etc/ssmtp.conf -- a config file for sSMTP sendmail. # # See the ssmtp.conf(5) human being page for a to a greater extent than verbose explanation of the # available options. #  # The individual who gets all post for userids < 500 # Make this empty to disable rewriting. root=username@gmail.com  # The house where the post goes. The actual machine get upward is required # no MX records are consulted. Commonly mailhosts are named mail.domain.com # The illustration volition represent if yous are inwards domain.com as well as your mailhub is hence named. mailhub=smtp.gmail.com:587  # Example for SMTP port disclose 2525 # mailhub=mail.your.domain:2525 # Example for SMTP port disclose 25 (Standard/RFC) # mailhub=mail.your.domain # Example for SSL encrypted connecter # mailhub=mail.your.domain:465  # Where volition the post look to come upward from? #RewriteDomain=gmail.com  # The sum hostname Hostname=gmail.com AuthUser=username@gmail.com AuthPass=Password # Set this to never rewrite the "From:" describe (unless non given) as well as to # purpose that address inwards the "from line" of the envelope. #FromLineOverride=YES  # Use SSL/TLS to shipping secure messages to server. #UseTLS=YES  # Use SSL/TLS certificate to authenticate against smtp host. #UseTLSCert=YES  # Use this RSA certificate. #TLSCert=/etc/pki/tls/private/ssmtp.pem TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt # Get enhanced (*really* enhanced) debugging data inwards the logs # If yous desire to bring debugging of the config file parsing, movement this pick # to the transcend of the config file as well as uncomment #Debug=YES USESTARTTLS=YES 

Step iv -

Now login using your username@gmail.com describe organisation human relationship as well as enable access for less secure app access using below url:
https://www.google.com/settings/security/lesssecureapps










Looks similar higher upward image.

Step five -

Let's exam configuration using below command. If everything goes good ascendancy output should similar below.

[root@cent backupdir]# echo "test" | ssmtp -vvv gmailaddress@gmail.com [<-] 220 smtp.gmail.com ESMTP ya6sm63613641pab.22 - gsmtp [->] EHLO gmail.com [<-] 250 SMTPUTF8 [->] STARTTLS [<-] 220 2.0.0 Ready to starting fourth dimension TLS [->] EHLO gmail.com [<-] 250 SMTPUTF8 [->] AUTH LOGIN [<-] 334 VXNlcm5hbWU6 [->] bWV0cm9sYW5kYW1hckBnbWFpbC5jb20= [<-] 334 UGFzc3dvcmQ6 [<-] 235 2.7.0 Accepted [->] MAIL FROM:<root@gmail.com> [<-] 250 2.1.0 OK ya6sm63613641pab.22 - gsmtp [->] RCPT TO:<gmailaddress@gmail.com> [<-] 250 2.1.5 OK ya6sm63613641pab.22 - gsmtp [->] DATA [<-] 354  Go ahead ya6sm63613641pab.22 - gsmtp [->] Received: past times gmail.com (sSMTP sendmail emulation); Wed, 10 Aug 2016 17:21:27 +0530 [->] From: "root" <root@gmail.com> [->] Date: Wed, 10 Aug 2016 17:21:27 +0530 [->] exam [->] [->] . [<-] 250 2.0.0 OK 1470829891 ya6sm63613641pab.22 - gsmtp [->] QUIT [<-] 221 2.0.0 closing connecter ya6sm63613641pab.22 - gsmtp [root@cent backupdir]#  

That's ALL, SSMTP have been configured successfully as well as sending email.

That's All
!!!Cheers!!!


Sumber https://linuxhowtoguide.blogspot.com/

Tidak ada komentar:

Posting Komentar