Search code examples
smtpgmailrhel7

Sending mail through Command line RHEL 7


I ‘m having difficulty sending mail.

My mail.rc is below

account gmail {
set smtp-use-starttls
set ssl-verify=ignore
set smtp-auth=login
set smtp=smtp://smtp.gmail.com:587
set from=”[email protected]”
set smtp-auth-user=uname
set smtp-auth-password=***********
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb/
}

But I’m getting error

[root@localhost ~]# echo -e “Mail body text” | mailx -A gmail    -s“Mail       subject” uname.example.com

[root@localhost ~]# Error in certificate: Peer’s certificate issuer is   not recognized.
smtp-server: 534-5.7.14 Please log in via your web browser and
smtp-server: 534-5.7.14 then try again.
smtp-server: 534-5.7.14 Learn more at
smtp-server: 534 5.7.14 https://support.google.com/mail/answer/78754  205sm11220769pfy.32 – gsmtp
“/root/dead.letter” 11/337
. . . message not sent.

I think I’m having a certificate issue. I used the firefox certificates also. Still same issue.

I’m using RHEL7 .

Could you please help me


Solution

  • I changed some setting in google account, more likely to reduce the security little bit.

    Following is the link to do so.

    http://www.google.com/accounts/DisplayUnlockCaptcha

    Below link will enable the acess to less secure apps.

    https://support.google.com/accounts/answer/6010255