TUTORIAL How to use SMTP Smarthost

Rob Huseman

New Member
Joined
Oct 23, 2010
Messages
5
Reaction score
0
Hello, I am new to this and need some help please. What I need to do is to have the voicemail not use any of the dyndns settings and just send all of the email directly to my border exchange server and use it for SMTP relay. Can anyone tell me how to set that please? Also, how can I edit the default email text in order to add corporate disclaimers etc to the existing fields? Any and all help is appreciated. Thanks in advance.

Rob
 

randy7376

Defnyddiwr Gweithredol
Joined
Sep 29, 2010
Messages
864
Reaction score
144
If you're using sendmail, and you don't need to make any other changes, you can get by with modifying /etc/mail/sendmail.cf. Be sure to make a backup copy first in case you mistype anything.

As root, look for this information near the top of the file:
Code:
# "Smart" relay host (may be null)
DS
With no spaces in between, add your server information. For example:
Code:
# "Smart" relay host (may be null)
DSexchange.mydomain.com
Restart sendmail (as root) with 'service sendmail restart'.

FYI... sendmail is not for the faint-of-heart. Directly editing sendmail's configuration files are something that is highly discouraged.
 

Rob Huseman

New Member
Joined
Oct 23, 2010
Messages
5
Reaction score
0
Thanks Randy for the response, but have to admit that this is still not making sense to me. I had found and tried what you referenced, but the emails are still coming in with strange trace behaviour and I am not sure why. Also, it appears that their must be more settings in PBXIAF than are in sendmail, because I get double entries for first the 127.0.0.1 and then for the private server address. That leads me to beleive that either Asterisk or PBXIAF are the ones generating and sending the original email. Any further advice is truly appreciated... this one has me stumped so far.
 

randy7376

Defnyddiwr Gweithredol
Joined
Sep 29, 2010
Messages
864
Reaction score
144
I'm not quite sure I'm following you. Can you elaborate more on 'strange trace behaviour' and 'double entries'?

The sendmail daemon should accept mail from the local system and forward it on to your smarthost with the above configuration as long as the e-mail address it is sending to is valid.

You can use the 'mailq' command on the PBX to see if any mail is currently sitting in the mail queue.

The setting above should pass this along to your smarthost directly.

My only other thought: Does your Exchange server have an entry in it's SMTP configuration to allow your PBX accesss?
 

Rob Huseman

New Member
Joined
Oct 23, 2010
Messages
5
Reaction score
0
Below is the mail header showing the path that it follows. It first starts from a 127.0.0.1 (local host) and is then forwarded to a second SMTP relay of dyndns.org but with the private IP of the server and then as the third stop it enters my exchange border server. My Exchange server is configured to allow for relay from the PBXIAF ip. What I would like to do is to either have Asterisk use my border server as its first hop and eliminate both first hops or to at the minimum have it be the second hop. Since I send mail externally to the domain at some times, I am having trouble with rejections (probably being detected as SPAM) and I want to reduce the hops and have my exchange border do the sending because it is properly configured (reverse DNS, registered server et al) for sending mail and rarely gets rejected. I also need to add a significant signature to the outgoing mail (both a disclaimer and more intentionally a good bit of text to eliminate any appearance of the email being SPAM and having a good signature really helps avoid most heuteristic detection apps) for the same reason as well as to make it appear more professional. Anyway, that is why I keep asking where the email is originated from (PBXIAF, FreePBX or Asterisk) and where sendmail fits into the picture. I also have in webmin only something called "procmail filter" and no entry for sendmail as some of the post say I should have. I did add to and regerate the sendmail cf file and that is in place and the below mail trace is after that is in place. Thanks again for your help... it is really appreciated.

Microsoft Mail Internet Headers Version 2.0
Received: from assi-wpb-dmz-02.assinet.com ([10.1.1.49]) by ASSI-WPB-EMS-01.assinet.com with Microsoft SMTPSVC(6.0.3790.4675);
Fri, 10 Dec 2010 15:28:11 -0500
Received: from pbx.dyndsn.org ([10.1.1.101] RDNS failed) by assi-wpb-dmz-02.assinet.com with Microsoft SMTPSVC(6.0.3790.4675);
Fri, 10 Dec 2010 15:28:11 -0500
Received: from pbx.dyndsn.org (pbx.dyndsn.org [127.0.0.1])
by pbx.dyndsn.org (8.13.8/8.13.8) with ESMTP id oBAKS9Z6006406
for <[email protected]>; Fri, 10 Dec 2010 15:28:09 -0500
Received: (from root@localhost)
by pbx.dyndsn.org (8.13.8/8.13.8/Submit) id oBAKS9pZ006405;
Fri, 10 Dec 2010 15:28:09 -0500
Date: Fri, 10 Dec 2010 15:28:09 -0500
From: "ASSI Voicemail" <[email protected]>
To: "Rob Huseman" <[email protected]>
Subject: [PBX]: New message 1 in mailbox 2206
Message-ID: <[email protected]>
X-Asterisk-CallerID: 5700
X-Asterisk-CallerIDName: Rob Huseman
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----voicemail_122063006938850611"
Return-Path: [email protected]
X-OriginalArrivalTime: 10 Dec 2010 20:28:11.0714 (UTC) FILETIME=[C3CD7220:01CB98A8]
 

Rob Huseman

New Member
Joined
Oct 23, 2010
Messages
5
Reaction score
0
BTW, the failed RDNS in the header along with an undeliverable return path are two more of the things I am specifically trying to elimate by putting valid information into the origin. Thanks again.
 

randy7376

Defnyddiwr Gweithredol
Joined
Sep 29, 2010
Messages
864
Reaction score
144
Rob,

It is only making one hop. The sendmail daemon is configured to accept mail only on the loopback address (127.0.0.1), but it uses the IP address 10.1.1.101 you assigned it to transfer the mail to the Exchange server. It is working with the smarthost entry as it should. It is not using any external resources. Ignore the dyndsn.org info and you'll see it.

Also, I think you meant to type dyndns.org, right? You should find pbx.dyndsn.org in /etc/sysconfig/network if you want to correct the typo. Personally, I would set the hostname to something valid for your network infrastructure.

You do have a DNS issue, though. This seems to be your biggest problem:

Code:
Received: from pbx.dyndsn.org ([10.1.1.101] RDNS failed) by assi-wpb-dmz-02.assinet.com with Microsoft SMTPSVC(6.0.3790.4675);
Do you have Exchange configured to do reverse DNS lookups when it accepts mail? Two things to consider. Either turn off RDNS lookups on Exchange or add a reverse lookup record for your PBX IP to your internal DNS server.

You may also need to tell Exchange that it's OK to accept mail from 10.1.1.101. I am not an Exchange expert by any means, so you're probably going to have to research that end of things.

I would venture a guess that Exchange is probably flagging it/dropping it as spam via Intelligent Message Filter or through any DNS block lists you may have configured because of the reverse lookup failure.

Make sure your forward and reverse lookups for your PBX are working and that the Exchange server can resolve them.

As for adding the the tagline you want, I have no clue. I believe that is something you would want to do on the Exchange side with every e-mail that gets processed.
 
Joined
Nov 20, 2010
Messages
159
Reaction score
0
It appears that you have properly configured Sendmail to relay through your Exchange server, which is now acting as a smart host.

The pbx.dyndns.org is a placeholder name found in /etc/hosts You should change it to the hostname that you prefer for your PBX In A Flash box (public or private). While you are at it, you should also check/change /etc/asterisk/vm_general.inc for this line [email protected] and change it as needed.

You can't eliminate the headers from within Sendmail/PIAF. Especially the RDNS header which is being injected by your receiving Exchange server. You can however configure Exchange with transport rules that will strip these headers before sending the message on to the outside world.

Sendmail can be configured to insert signatures but, it is cumbersome and certain to be an issue for you on PIAF. The previously mentioned Exchange transport rules can also be used to inject any signatures that you may desire. Exchange transport rules are definitely the way to go.

While not part of your question, I do feel compelled to say that I disagree with your reasoning for the lengthy signatures. Contrary to the ramblings of uninformed bureaucrats, email signature disclaimers are in no way legally binding. But, I understand that this decision may not be your own. But, lengthy signatures to evade spam filtering indicates either improper filter setup or highly dubious email content. Signatures are not the proper way to avoid spam filters.
 

Linetux

Guru
Joined
Oct 5, 2008
Messages
541
Reaction score
1
Short of properly configuring your own DNS servers (with correct internal and external name resolution), the fastest way to fix this problem is to put an entry in your hosts file on the Exchange server ( %system32%\etc\hosts ) - just a single line like:

10.1.1.101 pbx.dyndns.com

would work.
 

Rob Huseman

New Member
Joined
Oct 23, 2010
Messages
5
Reaction score
0
Thanks very much for your reply. Those locations will help a great deal. I would be interested to hear your opinion on the signatures (further than what you said), but the fact as I know it is that charecter count is part of most heuteristic filters and the only solution we have found (and it works for us) for our mobile phones and for our IPads etc has been to increase the signature length to avoid SPAM filter rejection. We have no problem with our workstations nor notebooks being rejected by SPAM filters on any mail sent. The research that we did strongly suggested increased charecter count as the primary solution for the problem. Any other suggestions for that would be welcome, because not married to signatures as the solution. That just works (soon as we increase signature length on the IPads and Phones they are no longer rejected) so we use it. Thanks again for the reply and the fields you gave me to modify will help a lot.

Rob
 

robf

Member
Joined
Nov 19, 2010
Messages
43
Reaction score
1
Important safety TIP!
I HIGHLY recommend that you not edit sendmail.cf directly.
sendmail.mc is the file you should be editing. If a make is done in the /etc/mail directory then your sendmail.cf mods will be overwritten based on what is in sendmail.mc

you should edit sendmail.mc and then issue a make and then it will build sendmail.cf

I've not configured my pbx to relay to an exchange server so I can't help there.
 

Linetux

Guru
Joined
Oct 5, 2008
Messages
541
Reaction score
1
I support an enterprise mail system... have for over a decade. Thing is, the number of characters in the e-mail have no practical bearing on the chance of it getting tagged or not.

Yes, heuristics to take into account the number of characters. But more than likely what you're running into is an improperly configured mail system.

Thing such as RDNS and SFP records are more important than character count. Also, ensuring that your mobile clients are sending thru your server is one of the biggest problems you're probably having.

But this is a PIAF form, not Exchange/Sendmail... so I'm going to stop short of telling you what you need to do because this thread would become filled with stuff that's completely irrelevant to PIAF.
 

Members online

Forum statistics

Threads
25,778
Messages
167,504
Members
19,198
Latest member
serhii
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