Elastix Without Tears Page 190 of 275
mail servers, the users on the network are performing POP3 receives on a
regular basis, all through the External IP address of their Internet connection, so
to the ISP/Webhost it is seeing someone authenticate using POP3 every few
minutes, and providing your Postfix server is sending out mail with 30 secs of one
of these POP3 receives, your mail will go out and be accepted, miss a window
and your mail fails. At night it is worse, as the mail users have gone home, turned
off the PC, and no one is doing any POP3 receives, so all your mail from Elastix
system fails. You get back in the morning and it is working again.
You might wonder why all the hassle with trying to send email via your own server, but
over the last few years it has become necessary as ISP/Webhosts have tried to stem the
spread of SPAM email. In some cases, it is a legal requirement. If they do not try to limit
the SPAM coming out of their system, or IP addresses that they have control over, they
can be seen as promoting SPAM, which in turn can lead to possible legal ramifications.
If on your initial installation of Elastix, your emails work then great, you are probably one
of the lucky ones that can send out email direct, but they are generally not the rule.
So that we don’t go off on the wrong track, it is necessary to look at the mail log to see
why your email failed. In most cases it will tell you what went wrong. You will need to SSH
into your system and get to the Linux Operating System or use your Console screen after
you have logged in. The file you want to look for is /var/log/maillog. So at the prompt
type less /var/log/maillog, and scroll up and down until you find the error close to the
time and date that the system tried to send an email. You will usually identify easily as it
will also have the email address in it, where the email was supported to go.
An example of a log file from a system that cannot send an email is as follows:
Apr 24 12:15:12 elastix postfix/smtp[30137]: 3D2EBCC5908: to=<
[email protected]>,
relay=myrealdomain.com.au[74.12.87.146]:25, delay=1.9, delays=0.02/0.01/1.5/0.36, dsn=5.0.0,
status=bounced (host mywebsite.com.au[74.12.87.146] said: 550-Verification failed for
[email protected]
What it tried to do here is send an email to
[email protected]. As we have
told it nothing of how to send the email, it has made a smart choice and tried to use the
myrealdomain.com.au mail server. Of which it has promptly replied Verification failed
(that’s because we have not setup any authentication).
So now we know it is not going to work in a default mode, so we have to make some
changes to the Postfix config file. We are now going to tell Postfix to route the mail via our
ISP’s mail server. Your ISP is going to be whomever you have an Internet connection
through e.g. Verizon might be mail.verizon.com, Westnet might be mail.westnet.com.au
(which is the one that we are using). So the changes in the next part include a relay host
(in other words a place that we route mail through), and the correct setup of the domain
names for the mail. The file is found in the /etc/postfix directory and is called main.cf. So
issue the following commands
cd /etc/postfix
nano main.cf
Change
#myhostname = host.domain.tld
#myhostname = virtual.domain.tld
to
myhostname = elastix1.myrealdomain.local
#myhostname = virtual.domain.tld
and a few lines further down change