LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how do I test my mail server's ability to receive email (http://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-test-my-mail-servers-ability-to-receive-email-4175446660/)

Laertiades 01-21-2013 06:50 PM

how do I test my mail server's ability to receive email
 
I have a domain: mydomain.com. I want to receive email to my home server at webmaster@mydomain.com. I followed this tutorial which had me install postfix, dovecot, procmail, spamassassin, and postgrey. The daemons are up and running. I can send mail with php scripts. nmap shows port 25 open. I am convinced the MX record of mydomain.com points to my external ip address. But when I send emails to webmaster@mydomain.com I see no evidence of them.

My questions are: Where would the email be? And, if they are supposed to be in /home/webmaster/Maildir, given the fact that they are not, how would I go about troubleshooting?

Any help, or enlightenment would be appreciated.

chrism01 01-21-2013 07:35 PM

You'll need to start at the beginning and check the log files on the sending machine eg /var/log/messages, /var/log/maillog and so on.
That should tell you if it sent ok.
If so, then start checking the receiver in a similar manner.
You may find spamassassin, and postgrey are set too aggressive and dumped your test email ;)

Ser Olmy 01-21-2013 07:58 PM

Quote:

Originally Posted by Laertiades (Post 4874988)
I am convinced the MX record of mydomain.com points to my external ip address.

Just in case you mean this literally: An MX record must never point directly to an IP address. It must point to a name registered as an A record (it can't point to a CNAME either), which in turn must point to the IP address of the responsible mail server.

You can test this in several ways:

- you could monitor incoming traffic to port 25 with tcpdump (tcpdump -v -i eth0 tcp port 25 should do the trick)
- use nc (netcat) or telnet to connect to port 25 on the mail server from an outside host and send SMTP commands (HELO, MAIL, RCPT and DATA)
- use one of the many relay testing services on the Internet (they tell you if your server is reachable, but won't test MX records)
- monitor the logs in real time with tail -f while you're sending mail using an outside host or a web based service

Laertiades 01-21-2013 08:54 PM

thanks for replies
 
Thank you Chrism01 and Ser Olmy for your help. I will make this quick response and then pursue your suggestions further.

I am trying to use a CNAME. Not by choice. I am trying to host multiple domains on my home server which has a dynamic ip. All I could get to work was to have a no-ip domain name to which I point the CNAME of my domain at 1and1 and then use the nginx virtual domain feature. It seems to be working, though: before I set up the mail server I sent an email to webmaster@mydomain.com and received this message in return from my host gateway:

<webmaster@sticky.no-ip.org>: connect to
sticky.no-ip.org[my.ip.addr.ess]:25: Connection timed out

The ip address was right. Now that I have the server installed I havn't received this return notice in response to my most recent email.

There don't seem to be any log files which concern mail on the server. I have been sending my test emails from FastMail. I will try disabling spamassassin and postgrey. tcpdump isn't a command on my system, I assume I will have to install it. I can telnet into port 25 from my workstation, though I don't know what to type after I am in to test anything. I will investigate that further.

So, thank you again. I appreciate your help. If you have any more insights I am all ears. I think I might already have enough to take me to the next level, though, and you have my gratitude.

correction: I did just get a failure message from my most recent email although this time the message is from my own server I guess:

This is the mail system at host www.mydomain.com.

####################################################################
# THIS IS A WARNING ONLY. YOU DO NOT NEED TO RESEND YOUR MESSAGE. #
####################################################################

Your message could not be delivered for more than 4 hour(s).
It will be retried until it is 1 day(s) old.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

The mail system

<webmaster@localhost> (expanded from <webmaster@mydomain.com>):
temporary failure. Command output: pipe: fatal: pipe_command: execvp
/usr/bin/perlbin/vendor/spamc: No such file or directory

There are also some attachments. I will look into this.

Ser Olmy 01-21-2013 09:10 PM

Quote:

Originally Posted by Laertiades (Post 4875075)
I am trying to use a CNAME. Not by choice. I am trying to host multiple domains on my home server which has a dynamic ip. All I could get to work was to have a no-ip domain name to which I point the CNAME of my domain at 1and1 and then use the nginx virtual domain feature.

You can point the MX record directly at the no-ip A record. No need to use a CNAME.

Having CNAMEs or IP addresses in MX records will work... sometimes. It all depends on the sending MTA; some stick to the RFCs and will refuse to deliver mails, while others are more forgiving. You really don't want your mail to depend on random quirks in various MTAs.

Quote:

Originally Posted by Laertiades (Post 4875075)
It seems to be working, though: before I set up the mail server I sent an email to webmaster@mydomain.com and received this message in return from my host gateway:

<webmaster@sticky.no-ip.org>: connect to
sticky.no-ip.org[my.ip.addr.ess]:25: Connection timed out

This could be an issue with your firewall or router, but it's also common practice for ISPs to block inbound traffic to DSL customers on port 25.

Since a TCP connection couldn't be established, you won't see anything in your logs. Double check router/firewall settings and experiment with other ports. You can check for open ports using one of the many port probing services on the Internet, such as GRC's ShieldsUP! If port 25 turns out to be the only port you can't connect to from the outside, it's likely that your ISP is to blame.

Laertiades 01-21-2013 09:45 PM

Thank you Ser
 
Thank you for your continued help Ser Olmy. I intend to look into your suggestions and ideas first thing tomorrow (brain is tired.) I will just say at this point that my domain is using a CNAME because if I just forward the domain to no-ip then I just get the nginx welcome page at my server (I am speaking of HTTP requests on 80). The virtual domain doesn't get used. I can't us the A record because it only takes an ip address (and mine changes). And I can't use any DNS server (that I know of). The people at 1and1 told me that I can't modify my email settings if I use a CNAME. But I will look into it further.

You have given me a lot to work on and I suspect that your help will prove effective. In any case you have my sincere gratitude for your time and effort.

btmiller 01-22-2013 12:39 AM

One other thing to do (if you have a shell account on a machine external to your LAN) is to telnet to port 25 on your machine and input SMTP commands directly (e.g. enter the command "telnet your.host.name 25"). If you don't speak SMTP, this page shows a basic sequence of SMTP commands required to transmit an e-mail. Note in particular any error messages in attempting to connect or send data through your SMTP server.

Laertiades 01-22-2013 08:27 AM

Telnet problems
 
Thank you btmiller. I am not able to telnet external to LAN but I did so from within and I think the session shed some light:

[laertiades@Athens ~]$ telnet Sparta 25
Trying 192.168.1.118...
Connected to Sparta.
Escape character is '^]'.
220 www.mydomain.com ESMTP
HELO local.domain.name
250 www.mydomain.com
MAIL FROM: myactual@emailaddress.com
250 2.1.0 Ok
RCPT TO: webmaster@mydomain.com
451 4.3.5 Server configuration problem
RCPT TO: webmaster@localhost
451 4.3.5 Server configuration problem

I am still unable to find an error log for postfix. I did however get the following from systemctl status postfix:

Jan 22 06:10:40 Sparta postfix/smtpd[16623]: warning: connect to 127.0.0.1:10030: Connection refused
Jan 22 06:10:40 Sparta postfix/smtpd[16623]: warning: problem talking to server 127.0.0.1:10030: Connection refused

I found the following line in /etc/postfix/main.cf:

smtpd_recipient_restrictions = permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination,
check_policy_service inet:127.0.0.1:10030

It seems that I am honing in on the issue (or rather you guys are) but I am still at a loss. I might mention that I have stopped iptables, spamassassin, and postgrey. Much thanks to all.

Laertiades 01-22-2013 10:33 AM

Problem solved
 
I fixed the problem and this might be helpful for other people using the tutorial: "A Simple Mailserver on Arch Linux" at http://www.gelens.org/archlinux-mailserver/

in /etc/postfix/master.cf I had to change the file location:
/usr/bin/perlbin/vendor/spamc
to:
/usr/bin/vendor_perl/spamc

I also had to have postgrey up and running because it had to make a connection on port 10030.

I also had to add the following line to /etc/dovecot/dovecot.conf:
listen = *
Something having to do with ipv6 (even though my server has ipv6 disabled per kernal option???)

Thank you so much, everyone, for you time and help. After several frustrating days I feel much lighter.


All times are GMT -5. The time now is 06:19 AM.