mattburris
Member
- Joined
- Dec 22, 2017
- Messages
- 31
- Reaction score
- 5
- Notes: If you use 2 step authentication, you will need to create an "App Password" in your Google Account settings. This will generate a 16 character you can use as a password for sending mail through your gmail account that normally requires 2-step.
Create a Gmail "App Password" here
More info and the hows and whys here
- Create the folder to hold your auth
Code:# mkdir -m 700 /etc/mail/authinfo/ # cd /etc/mail/authinfo/
- Create a file called "gmail-auth" in /etc/mail/authinfo/
Code:# nano /etc/mail/authinfo/gmail-auth
AuthInfo: "U:root" "I:YOUR GMAIL EMAIL ADDRESS" "P:YOUR PASSWORD"
- Next generate a hashmap db file for the authentication:
Code:# makemap hash gmail-auth < gmail-auth
- Next you will configure sendmail. Open sendmail.mc in nano:
Code:# nano /etc/mail/sendmail.mc
define(`SMART_HOST',`[smtp.gmail.com]')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_OPTIONS', `A p')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash -o /etc/mail/authinfo/gmail-auth.db')dnl
- Next rebuild the sendmail configuration:
-
Code:
# make -C /etc/mail
- Finally reload the sendmail service:
Code:# /etc/init.d/sendmail reload
- Test your sendmail with the following command:
Code:# echo "Testing my sendmail gmail relay on IncrediblePBX 13-13 RPi" | mail -s "Sendmail test via gmail Relay" [email protected]