SOLVED Sendmail config for SMTP - Raspberry Pi

DoubleDriveLine

Active Member
Joined
Sep 23, 2017
Messages
139
Reaction score
42
I made I believe all the correct settings in the sendmail.mc file to send emails out Incredible PBX on Raspberry pi.

My test mail fails. Looking at the mail.log file it does not understand the email domain. The domain although fake here is fine. The raspberry Pi resolves the domain name just fine when I ping it.

Do you have a tutorial for setting up the PBX to use an external SMTP server?

Where is the noreply.incrediblepbx.com set and will I blow something up if I change it. It looks like it is set in the "/etc/hosts" file.

127.0.1.1 noreply.incrediblepbx.com raspberrypi

root@raspberrypi:/etc/mail $ tail -f /var/log/mail.log
Oct 19 16:04:28 noreply sm-mta[28608]: gethostbyaddr(xxx.xxx.xxx.xxx) failed: 1
Oct 19 16:04:28 noreply sm-mta[30099]: starting daemon (8.14.4): SMTP+queueing@00:10:00
Oct 19 16:04:59 noreply sendmail[30119]: v9JK4xCN030119: [email protected], size=114, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
Oct 19 16:04:59 noreply sm-mta[30120]: v9JK4x4c030120: <double@someEmail.domain>... Unrecognized host name someEmail.domain.
Oct 19 16:04:59 noreply sendmail[30119]: v9JK4xCN030119: to=<double@someEmail.domain>, [email protected] (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30114, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.2, stat=User unknown
Oct 19 16:04:59 noreply sm-mta[30120]: v9JK4x4c030120: from=<[email protected]>, size=114, class=0, nrcpts=0, proto=ESMTP, daemon=MTA-v4, relay=pbx.local [127.0.0.1]
Oct 19 16:04:59 noreply sendmail[30119]: v9JK4xCN030119: v9JK4xCO030119: DSN: User unknown
Oct 19 16:04:59 noreply sm-mta[30120]: v9JK4x4e030120: from=<>, size=2291, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA-v4, relay=pbx.local [127.0.0.1]
Oct 19 16:04:59 noreply sendmail[30119]: v9JK4xCO030119: [email protected], delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31138, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v9JK4x4e030120 Message accepted for delivery)
Oct 19 16:04:59 noreply sm-mta[30121]: v9JK4x4e030120: to=<[email protected]>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=32525, dsn=2.0.0, stat=Sent
 
I think I got closer. The email was sent from what the logs said but I never received it.

Oct 19 18:26:38 noreply sendmail[7924]: v9JMQcAR007924: to=root, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31063, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v9JMQcv1007925 Message accepted for delivery)
Oct 19 18:26:38 noreply sm-mta[7926]: v9JMQcv1007925: to=<[email protected]>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=32419, dsn=2.0.0, stat=Sent
Oct 19 18:34:18 noreply sendmail[8521]: v9JMYIKd008521: from=root, size=39, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
Oct 19 18:34:18 noreply sm-mta[8522]: v9JMYIOQ008522: <double@someEmail.domain>... Unrecognized host name someEmail.domain.
Oct 19 18:34:18 noreply sendmail[8521]: v9JMYIKd008521: to=double@someEmail.domain, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30039, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.2, stat=User unknown
Oct 19 18:34:18 noreply sm-mta[8522]: v9JMYIOQ008522: from=<[email protected]>, size=39, class=0, nrcpts=0, proto=ESMTP, daemon=MTA-v4, relay=pbx.local [127.0.0.1]
Oct 19 18:34:18 noreply sendmail[8521]: v9JMYIKd008521: v9JMYIKe008521: DSN: User unknown
Oct 19 18:34:18 noreply sm-mta[8522]: v9JMYIOS008522: from=<>, size=2185, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA-v4, relay=pbx.local [127.0.0.1]
Oct 19 18:34:18 noreply sendmail[8521]: v9JMYIKe008521: to=root, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31063, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v9JMYIOS008522 Message accepted for delivery)
Oct 19 18:34:18 noreply sm-mta[8523]: v9JMYIOS008522: to=<[email protected]>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=32419, dsn=2.0.0, stat=Sent
 
Nope the problem is still in the sendmail configuration. It is still trying to send the mail out itself and not the remote smtp server.
 
I scrapped the idea of sendmail and installed ssmtp. It has two config files ssmtp.conf and revaliases
There are a number of references online to show you how to get this working with gmail but not any for any other smtp server. I had to work out the settings. Most were simple enough but one that should have been simple caused me the most difficulty. The "FromLineOverride=YES" value when set to YES caused
(550 Sender verify failed) errors. Once I set it to NO it worked as expected.



ssmtp.conf
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=postmaster
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=mail.somedomain.TLD:587
# Where will the mail seem to come from?
rewriteDomain=somedomain.TLD
# The full hostname
hostname=raspi.somedomain.TLD
[email protected]
AuthPass=[password]
#AuthMethod=LOGIN
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=NO
UseTLS=Yes
UseSTARTTLS=YES
#AuthLogin=Yes

I also had to add this to the revaliases file to have it send the message out with the proper account information. Without this set it tries to send the message out as an email account that is not on my server.

# sSMTP aliases
#
# Format: local_account:outgoing_address:mailhub
#
# Example: root:[email protected]:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.
root:[email protected]:mail.somedomain.TLD:587
asterisk:[email protected]:mail.somedomain.TLD:587
 
In code tags we don't get the :p emojis
Code:
# sSMTP aliases
#
# Format: local_account:outgoing_address:mailhub
#
# Example: root:[email protected]:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.
root:[email protected]:mail.somedomain.TLD:587
asterisk:[email protected]:mail.somedomain.TLD:587
 

Members online

Forum statistics

Threads
26,687
Messages
174,410
Members
20,257
Latest member
Dempan
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.
Back
Top