TUTORIAL IncrediblePBX 13-13 on Raspberry Pi use Gmail with Sendmail

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
  1. Create the folder to hold your auth
    Code:
    # mkdir -m 700 /etc/mail/authinfo/
    # cd /etc/mail/authinfo/

  2. Create a file called "gmail-auth" in /etc/mail/authinfo/
    Code:
    # nano /etc/mail/authinfo/gmail-auth
    Put the following inside the file: (obviously substitute your info in (but keep the "I: and "P:))
    AuthInfo: "U:root" "I:YOUR GMAIL EMAIL ADDRESS" "P:YOUR PASSWORD"
    *** If you use 2 Step authentication then make sure your use the "App Password" that you generated in the note at the top***
  3. Next generate a hashmap db file for the authentication:
    Code:
    # makemap hash gmail-auth < gmail-auth

  4. Next you will configure sendmail. Open sendmail.mc in nano:
    Code:
    # nano /etc/mail/sendmail.mc
    Put the following lines directly above the first MAILER_DEFINITIONS entry
    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

  5. Next rebuild the sendmail configuration:
  6. Code:
    # make -C /etc/mail
    Ignore the error line about sasl2-bin not installed, not configuring sendmail support.
  7. Finally reload the sendmail service:
    Code:
    # /etc/init.d/sendmail reload

  8. 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]
 

Members online

Forum statistics

Threads
25,782
Messages
167,513
Members
19,203
Latest member
frapu
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top