TUTORIAL Install gMail as SMTP Relay Host for SendMail

Discussion in 'PIAF 3 Add-Ons' started by wardmundy, Mar 16, 2008.

  1. biggy213

    biggy213 New Member

    Joined:
    Jan 5, 2009
    Messages:
    6
    Likes Received:
    0
    I followed the instruction but no joy. I am not getting any mail from Incredible PBX-FAX 13-12.2 for SL 6.7? Any suggestions?
     
  2. ostridge

    ostridge Guru

    Joined:
    Jan 22, 2015
    Messages:
    372
    Likes Received:
    66
    This code was needed because the 'sendmail-cf' directory is missing on these Debian/Ubuntu as sendmail/cf directory was used ; however
    The 1st sed code line has a delimiter missing - substitute the following line and you're good:
    Code:
    sed -i 's|sendmail-cf|sendmail\/cf|' /etc/mail/sendmail.mc
    
     
    wardmundy likes this.
  3. boilermanc

    boilermanc New Member

    Joined:
    Jul 7, 2011
    Messages:
    29
    Likes Received:
    2
    i get an error when entering both the makemap lines:

    -bash: makemap: command not found

     
  4. wardmundy

    wardmundy Nerd Uno

    Joined:
    Oct 12, 2007
    Messages:
    14,634
    Likes Received:
    2,497
  5. ostridge

    ostridge Guru

    Joined:
    Jan 22, 2015
    Messages:
    372
    Likes Received:
    66
    that also could be to do with permissions (chmod 640 ...) for the files referred to?
    genericstable genericstable.db client-info client-info.db


    makemap -r hash client-info.db < client-info
     
    wardmundy likes this.
  6. boilermanc

    boilermanc New Member

    Joined:
    Jul 7, 2011
    Messages:
    29
    Likes Received:
    2
    Thanks ward, i had to do a apt-get update and then reinstall sendmail. that got me back on track. i now find there is a file:

    sendmail.mc.gmail

    how does that play into the setup now?
     
  7. rogerjbos

    rogerjbos Member

    Joined:
    Mar 27, 2015
    Messages:
    46
    Likes Received:
    5
    Make sure and check your ports if you are on the cloud...

    I had a working setup for testing, and then I went to deploy it a few months later, the emails had stopped working. I spent many hours trying to fix it by going through many tutorials before I went to the cloud provider and asked them if they were blocking port 587. They were. Once they opened it everything worked great, but it wasted a lot of my time... lesson learned.
     
  8. JoeOIVOV

    JoeOIVOV New Member

    Joined:
    Sep 14, 2018
    Messages:
    22
    Likes Received:
    7
    Its easier to configure if you have your own SMTP relay, that way your not sending your data through Google. I use Microsoft Exchange Server and by default it will accept relayed mail from incrediblepbx without any modifications.

    Add SMTP Relay
    1. Edit Sendmail Make file /etc/mail/sendmail.mc:

    nano /etc/mail/sendmail.mc

    2. Edit the following line:

    dnl define(`SMART_HOST', `MAIL.DOMAIN.COM')dnl

    3. Remove the following lines as they are not needed, it defaults to port 25:

    define(`RELAY_MAILER_ARGS', `TCP $h 587')
    define(`ESMTP_MAILER_ARGS', `TCP $h 587')

    4. Remove the following lines if Authentication is not needed for internal relay as in my case:

    FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl

    5. Change the following lines:

    MASQUERADE_AS('DOMAIN.com')dnl
    dnl MASQUERADE_DOMAIN(DOMAIN.com)dnl
    MASQUERADE_DOMAIN(DOMAIN.com)dnl

    6. Save file and exit.

    7. Regenerate SendMail Configuration File /etc/mail/sendmail.cf:

    /etc/mail/make

    After this you can send the test mail:

    echo "test" | mail -s NotifyTest [email protected]

    and instead of the mail arriving from [email protected] it arrives from [email protected]{incrediblepbx.hostname.com} or [email protected]{DOMAIN.com}and never leaves your domain. This means that fax receipts and voicemails will also use this same mail server. I prefer to use my own mail server instead of GMAIL, here are the instructions I setup to apply after following the steps on the first page.
     
    #129 JoeOIVOV, Jan 31, 2019
    Last edited: Jan 31, 2019
    tycho and wardmundy like this.