TUTORIAL Gotcha-Free PBX: SMTP Mail Relay with Incredible PBX and Fax for Asterisk-GUI (RasPi 2 Edition)

dandy_don

Member
Joined
Sep 27, 2010
Messages
173
Reaction score
11
Firstly -- THANKS to Ward, et. al., for the great new implementation for the raspberry pi model 2! Very nice! You folks are brilliant!!!

Despite your great efforts, I'm having an issue with sending voicemail attachments... When using the "stock" configuration but with e-mail addresses assigned to the various extensions, voice mail works but no e-mail is being sent out.

I'm trying to resolve this by following the instructions given in part 15 of the instructions:
15. Reconfiguring SendMail for SmartHost SMTP Delivery of Outgoing Emails

My ISP is roadrunner so I have modified the /etc/mail/sendmail.cf file to read:
DSsmtp-server.roadrunner.com

However, when I then restart the mail server, I get the following error:
[....] Restarting Mail Transport Agent (MTA): sendmailhostname: Name or service not known

I've tried each of the three e-mail providers that I have and the result is the same. Not sure what I'm doing wrong.

Any help is much appreciated.
Thanks
Don
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
15,136
Reaction score
2,627
dandy_don Sounds like that's not the correct name for RoadRunner's SMTP server. In South Carolina, it's something like this:
Code:
smtp-server.sc.rr.com
 
Joined
Nov 19, 2007
Messages
170
Reaction score
7
Location
Georgia
I found on the setup I just went through, postfix ended up being my MTA. I had to modify /etc/postfix/main.cf to set the smarthost.
 

dandy_don

Member
Joined
Sep 27, 2010
Messages
173
Reaction score
11
Ward & Troy,

Thanks for the response. The original smtp server information I took was from my actual e-mail client running on my other PCs but this didn't solve the problem.
Ward -- Using your advice, I found that TWC recommends using "mail.twc.com" for the smtp server. I'm able to ping it, etc., so I changed the sendmail.cf to read "DSmail.twc.com" but the problem persists.

I'm going to now try Troy's information.. I'll let you know what happens.

Thanks!
Don
 

dandy_don

Member
Joined
Sep 27, 2010
Messages
173
Reaction score
11
Interesting... There isn't a /etc/postfix directory on the incrediblepi2...
 

dandy_don

Member
Joined
Sep 27, 2010
Messages
173
Reaction score
11
OK -- Very strange... I have the correct e-mail address in the extension and I have the enable voicemail box checked.
When I go into webmin and look at the sendmail cue, there are no messages in the cue. I've left multiple voice messages on two of the extensions but none of these messages are showing up in the sendmail cue...

I'm not sure where (or if) they are going...
 

dandy_don

Member
Joined
Sep 27, 2010
Messages
173
Reaction score
11
OK -- More intriguing.. If I restore the smtp server line back to simply DS from either DSsmtp-server.roadrunner.com, or DSmail.twc.com, then the voice mail messages do start stacking up in the sendmail cue (according to webmin), so clearly the messages are going somewhere.

So when simple "DS" the sendmail cue grows.
When "DSsmtp-server.roadrunner.com" or "DSmail.twc.com", the sendmail cue remains empty.

I've logged onto my mail providers via webmail and looked into the spam folders but these messages are not getting trapped as spam, nor are they getting into the respective inboxes.

At this point when I have a valid smtp server referenced in the sendmail.cf file, it appears that the messages are going somewhere because they are not shown in the sendmail cue, but neither are they making it to any of my e-mail accounts. I've tried using the three e-mail addresses (from different providers) in the extension configuration but none of the e-mail providers seem to be getting the messages. Sorry if I'm repeating -- just wanted to be clear.

Nothing like a good puzzle! -- Thanks!

Don
 

synack

Guru
Joined
Dec 31, 2013
Messages
229
Reaction score
56
can you try something? you will need the following bits of info first:
your external ip that the mail server sees you as (whatismyip.com)
the "from" email address
the "to" email address
the mail server smarthost.

from the voicemail server:
Code:
telnet mailserversmarthost 25
this will open a telnet session and the server should respond with a greeting.

respond to that greeting with:
Code:
helo YourExternalIp
The server should reply to your greeting.
next commands:
Code:
mail from:<FromEmailAddress>
rcpt to:<ToEmailAddress>
data
Subject: test email
 
this is a test
.
be sure the last period is on it own line and only the period and [enter]
you should either get errors along the way or message accepted at the end.
 
Joined
Nov 19, 2007
Messages
170
Reaction score
7
Location
Georgia
Interesting... There isn't a /etc/postfix directory on the incrediblepi2...
Odd. I did the entire RPi2 install (albeit on an RPiB), but after installing everything, including incrediblefax, my MTA had switched to postfix. Once I changed added the smarthost in the postfix config file, emails started flowing to my main mail server (I have the pbx forwarding to my internal email server so it can handle delivery to the final destinations...it already knows about my ISP smarthost).
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
15,136
Reaction score
2,627
I found on the setup I just went through, postfix ended up being my MTA. I had to modify /etc/postfix/main.cf to set the smarthost.

SendMail gets replaced with Postfix if you install Incredible Fax. That was the design of the original build for the RasPi platform, and we haven't had time to address it. Sorry.

 
Joined
Nov 19, 2007
Messages
170
Reaction score
7
Location
Georgia
SendMail gets replaced with Postfix if you install Incredible Fax. That was the design of the original build for the RasPi platform, and we haven't had time to address it. Sorry.

Don't worry about it and don't make it priority...I use both, but mostly Postfix now. Just mention it in the documentation because even though Postfix is involved, the sendmail.cf file is still there and may confuse people if they don't know to look for the Postfix files.

Anyway:
1. Edit /etc/postfix/main.cf
2. Add the appropriate smarthost on the line that starts "relayhost ="

I typically put the relay host FQDN in square brackets, like this: [smtp.charter.net] to prevent MX record lookup. If you need a port number with auth credentials, it's a little more complicated but doable.
 
  • Like
Reactions: wardmundy

dandy_don

Member
Joined
Sep 27, 2010
Messages
173
Reaction score
11
Synack,

Thanks for the response. I did as you suggested and all went well... I got the expected responses to the telnet, etc., and I was able to send the e-mail to several different e-mail addresses.
Where do I go from here?

I really appreciate you taking the time to respond and offer suggestions. You, Ward, and all of the other friendly "brainiacs" are what make this venue so helpful and (somtimes) funny!

Thanks,
Don
 
  • Like
Reactions: wardmundy

gpuser

Member
Joined
Aug 19, 2013
Messages
37
Reaction score
12

synack

Guru
Joined
Dec 31, 2013
Messages
229
Reaction score
56
If those messages went successfully, I would suspect that the wrong values are being sent to sendmail/postfix whatever.
I would remove the smarthost from your config, let a couple test messages queue up and take a closer look at one.
iirc they are in /var/spool/mqueue
cat or vi one of the messages and look at the header information to see if the from: and to: addresses are correct.
My guess is they are not correct, which is why they are queuing up on your server. Sendmail/postfix normally would try to deliver directly and queue up failed attempts.
 

dandy_don

Member
Joined
Sep 27, 2010
Messages
173
Reaction score
11
Synack -- Thanks for the response. Here is the output of one of the fines in the /var/spool/mqueue directory. The target e-mail address was correct as was the domain of the e-mail server. I have sanitized those items and here is the output of that file:


Code:
[email protected]:/var/spool/mqueue# cat dft1K15jQA001572
This is a MIME-encapsulated message
 
--t1K15jQA001572.1424394345/incrediblepi2
 
The original message was received at Thu, 19 Feb 2015 20:05:43 -0500
from pbx.dyndns.org [127.0.0.1]
 
----- The following addresses had permanent fatal errors -----
<my correct email address here>
(reason: 550-Verification failed for <[email protected]>)
 
----- Transcript of session follows -----
... while talking to MY EMAIL DOMAIN WAS HERE:
>>> DATA
<<< 550-Verification failed for <[email protected]>
<<< 550-The mail server could not deliver mail to [email protected] The account or domain may not exist, they may be blacklisted, or missing the proper dns entries.
<<< 550 Sender verify failed
550 5.1.1 <my correct email address here>... User unknown
<<< 503-All RCPT commands were rejected with this error:
<<< 503-Sender verify failed
<<< 503 Valid RCPT command must precede DATA
 
--t1K15jQA001572.1424394345/incrediblepi2
Content-Type: message/delivery-status
 
Reporting-MTA: dns; incrediblepi2
Received-From-MTA: DNS; pbx.dyndns.org
Arrival-Date: Thu, 19 Feb 2015 20:05:43 -0500
 
Final-Recipient: RFC822; my correct email address here
Action: failed
Status: 5.1.1
Remote-MTA: DNS; MY EMAIL DOMAIN WAS HERE
Diagnostic-Code: SMTP; 550-Verification failed for <[email protected]>
Last-Attempt-Date: Thu, 19 Feb 2015 20:05:45 -0500
 
--t1K15jQA001572.1424394345/incrediblepi2
Content-Type: text/rfc822-headers
 
Return-Path: <[email protected]>
Received: from incrediblepi2 (pbx.dyndns.org [127.0.0.1])
by incrediblepi2 (8.14.4/8.14.4/Debian-4) with ESMTP id t1K15hQA001568
for <my correct email address here>; Thu, 19 Feb 2015 20:05:43 -0500
Received: (from [email protected])
by incrediblepi2 (8.14.4/8.14.4/Submit) id t1K15hf2001565;
Thu, 19 Feb 2015 20:05:43 -0500
Date: Thu, 19 Feb 2015 20:05:42 -0500
From: Asterisk PBX <[email protected]>
To: "6001" <my correct email address here>
Subject: New Voicemail Message
Message-ID: <[email protected]>
X-Asterisk-CallerID: 6002
X-Asterisk-CallerIDName: 6002
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----voicemail_1600131705935299405"
 
--t1K15jQA001572.1424394345/incrediblepi2--
 
[email protected]:/var/spool/mqueue#
 

dandy_don

Member
Joined
Sep 27, 2010
Messages
173
Reaction score
11
Gpuser -- Thanks for the suggestion. If I can't get this resolved, I may try your suggestion. However from the reply I posted just a minute ago, it appears that it may just be a permissions issue with the sending of mail to [email protected]

Thanks,
Don
 

synack

Guru
Joined
Dec 31, 2013
Messages
229
Reaction score
56
You probably need to tell sendmail it's ok to relay.
As all my voicemail notifications go to a single email domain, i've done it this way:
Code:
cd /etc/mail/
echo 'emaildomain esmtp:destinationserverhost' >> mailertable
make mailertable.db
restart sendmail/postfix
for destinationserverhost, pick the mail server FQDN the email should go to. you can use an IP address by encapsulating it in square braces like this: [192.168.0.1]

This assumes of course your internet provider does not block SMTP port 25 to the internet.

Another place you can look to troubleshoot is /var/log/maillog
tail -f that while sending and see what you get back.
 

dandy_don

Member
Joined
Sep 27, 2010
Messages
173
Reaction score
11
Synack,

Thanks for the suggestions. I've done as you suggested but it still does not work.

I've looked at the log file and perhaps this is the issue. The first line of the maillog file (for each new message) suggests that there may be errors locating the host?
For example, here is the first line of the maillog corresponding to the most resent attempt. The server internal address is 10.10.220.182

Feb 22 13:59:12 incrediblepi2 sm-mta[4422]: gethostbyaddr(10.10.220.182) failed: 4

Thanks,
Don
 

dandy_don

Member
Joined
Sep 27, 2010
Messages
173
Reaction score
11
MGD4me,

I thought that was odd as well. However it seems to point to incrediblepi2 in the /etc/hosts file. Here are the contents of the hosts file for this server:

[email protected]:/etc# cat hosts
127.0.0.1 pbx.dyndns.org localhost
::1 pbx.local localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
noreply.incrediblepbx.com 127.0.1.1 incrediblepi2
 

Members online

PIAF 5 - Powered by 3CX

Forum statistics

Threads
22,367
Messages
137,355
Members
14,575
Latest member
Issue