is my server an open relay
send a basic message
checking queued messages
to disable cron from sending email
Checking email headers
To send and receive mail, the following need to be setup (and configured):
- mta mail transfer agent - (sendmail/pop/imap) responsible for sending
- mua mail user agent - mail clients i.e outlook,evolution,mail,mutt
- mda mail delivery agent - local delivery agent (puts in mail box) proc mail
So what happens when you try to send an email?
- it goes to local email server
- message queued on the mail server
- link established to destination (on port 25)
- destination confirms ok and local sents it on
- receipt of email confirmed
- mda puts in mail spool for end receipant
without a catchall and if email address is wrong, destination email server will reject the mail
(although will retry) and bounce back message to the sender
if the destination mail server is down, the sending mail server will retry and eventually bounce back message to the sender if unsuccessful.
for details on setting up sendmail see http://linuxblog.info/setting-up-sendmail/
To receive mail you need to install a MTA (mail transfer agent) 2 of the most popular are postfix (installed by default with centos) and sendmail.
postfix is generally considered to be an improved version of sendmail.
sendmail.cf is the main sendmail configuration file.
sendmail.mc Is a macro that's easier to edit, which can be used to generate a new sendmail.cf file.
1) install sendmail,sendmail-cf and m4 and make sure postfix is turned off or uninstalled
2) edit the /etc/mail/sendmail.mc (note it is dnl (Lima) not dn1 (1 the number) and change
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
3) m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf (to build the config file)
4) service sendmail restart (restart the service
5) check sendmail is listening on port 25 (netstat -plant | grep LISTEN)
6) hostname >> /etc/mail/relay-domains
7) open your firewall iptables -A INPUT -p tcp -m tcp –dport=25 -j ACCEPT
8) if you want to receive email from multiple domains add the domain names to /etc/mail/local-host-names
9) to add catch all's add users to /etc/mail/virtusertable in the format @domain user_to_get_mail
you then need to setup the Dns mx records to point at your server
i was having a lot of issues setting this up initally,the best page i found was http://hpclab.blogspot.co.uk/2012/02/set-up-email-server-on-centos-62-within.html
run a test from somewhere such as http://mxtoolbox.com/diagnostic.aspx
echo "test" | mail -s testsubject email@example.com
running mailq which is the same as sendmail -bp prints a summary of the mail messages queued for future delivery.
cd /var/spool/mqueue and delete all files if you want to get rid of all messages in the queue:
MAILTO="" to disable mail
a good site to check email headers
DomainKeys Identified Mail (DKIM) lets an organization take responsibility for a message that is in transit. The organization is a handler of the message, either as its originator or as an intermediary. Their reputation is the basis for evaluating whether to trust the message for further handling, such as delivery. Technically DKIM provides a method for validating a domain name identity that is associated with a message through cryptographic authentication.
more reading http://www.dkim.org/