Mail problems

ornicar
ornicar used Ask the Experts™
on
I installed xMail server to setup my home mail server.
Even before this:
1) I am unable to send mails with sendmail (console or cgi scripts) except from KMail client (maybe there is a log somewhere but I don't know because I am a rookie).
2) Unable to receive any mails, even from KMail (unknown host whatever I try for my server: localhost, host.domain, ip address,...)

I am lost on what to do. Can you help me to make my home mailserver work?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2005

Commented:
Sendmail logs to /var/log/maillog on most Linuxen (I don't know what flavor you are using). You can get immediate feedback on what is happening by doing:

/usr/sbin/sendmail -v some-user@some-dom.tld

If you happen to be using a 7.x or later RedHat system, sendmail is, by default, configured to only accept mail from the localhost IP. That is easily fixed by editing /etc/mail/sendmail.mc and commenting out the line that reads:

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')

then building a new sendmail.cf using the command at the beginning of the sendmail.mc file and re-starting sendmail (service sendmail restart). Also note that for sendmail to deliver mail to Internet hosts the default gateway and DNS must be properly configured and working.

If you are trying to read mail using another system, you'll need to have a POP and/or IMAP service installed.

Author

Commented:
Sorry, forgott to mention that I have Mandrake 7 and there is not much with sendmail -v and no /etc/mail/sendmail.mc

Top Expert 2005

Commented:
Okay, with MD 7 you don't need to futz with the sendmail configuration to enable inbound SMTP.

Is mail just getting queued (check with mailq)? Are any errors being logged in /var/log/maillog?

Does the system have normal Internet connectivity (you can browse internet sites normally)?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
mailq is empty, in fact, I can send mail from console and kMail.
Internet is fine, I can browse fine and if I ping my host.domain.com I obtain 10.0.0.4 which I believe is correct.
I've found the logs in /var/log/mail but nothing interresting: error shows one error from 4 hours ago and I believe it comes from way before. Nothing else comes when I try.  
I still have 2 problems: I cannot receive mail in kMail (says error connecting to host.domain.com) and I cannot send using a cgi script I've downloaded and imstalled (using the SMTP option with another mail server works).

Author

Commented:
However I can read mail with the mail command line.

Author

Commented:
Made a mistake, I have Mandrake 8.2
Top Expert 2005
Commented:
Okay, let's deal with one problem at a time.

Fist we need to make sure that sendmail and the machine's configuration is correct. To do that you want to send yourself a message from the command line and send a message to some address that you can verify delivery outside of the local machine. To send a message to youself do something like:

/usr/sbin/sendmail -v my-user-name
From: my-user-name@my-domain.tld
Subject: Test

A test
^D

(That's a CTRL-D to end the message) Then check mail locally with 'mail' and see if the message was delivered.

Next send a message to someplace outside. The address needs to be some account that you have or someone who can tell you if the message arrived. If you don't have an account elsewhere that you can use, you can send the message to me, for example:

/usr/sbin/sendmail -v jim@entrophy-free.net
From: my-user-name@my-domain.tld
Subject: Test messagae, EE question

This is a delivery test to verify mail functionality
^D

After sending the message check 'mailq' to see that the message has been processed and is no longer ququed for delivery. Also check /var/log/maillog to see that the message has been sent.

Assuming that both messages get delivered with no problems, the next task is to see if inbound email works. To have a trully functional mail server you need to have a static IP and a domain name registered with the correct records using that static IP. To make sure that sendmail knows to handle mail for your domain the hostname of the machine must be set to reflect what is configured in the DNS for your domain and you'll want /etc/mail/locla-host-names to conatin:

my-domain.tld
this-host.my-domain.tld

To verify things are working, you use another mail account elsewhere on the Internet (preferably one where you can check the mail logs) to try to send a message to your system.

As to the Kmail problem. Do you have an IMAP/POP server installed and operational? Kmail is going to try to get the mail with IMAP or POP, which ever you've selected, and if the serice isn't available it will fail. It will also fail if the networking configuration isn't correct with respect to hostname and the hosts file.

Author

Commented:
Thanks for this clarification.

- Sending a message to myself works
- Sending a message to outside e-mail works as well

- Resolution of my domain name is correct. When i send a message from outside to myself@mydomain.com, after a couple of hours I receive a message in this mail saying 'Connection refused by mail.mydomain.com'. I'm missing something here.

- Apparently, I have no IMAP service. Where can I get a package for imap? I have difficulty to find the right place to download from.
Top Expert 2005

Commented:
A "connection refused" failure for inbound email when everything works locally sounds like a firewall issue. Are you running a firewall on this system or is there a firewall between you and the Internet?

The should be an IMAP server package on your Mandrake CD's. Look for and imap package.

Author

Commented:

AAAAH! Firewall! I opened the ports and now the message is different, it replies:

'Relay access denied'

Have read something about /etc/mail/access but can't find any /etc/mail directory. Searched the whole box for sendmail.mc with nothing found either.


Top Expert 2005

Commented:
Okay, that's getting closer. I think the problem now is that the system doesn't believe that it is to handle email for your domain and thus the message is a relay attempt. And we fix that by making sure that local-host-names is correct, per the comment above. If you change the file be sure to restart sendmail.

Author

Commented:
Some progress!

Didn't find this file so created mail directory and local-host-names file.

Now, I can read this machine's email from another machine, probably using the DNS from inside the LAN.

Still, when sending email from outside, I have this response:


   ----- The following addresses had permanent fatal errors -----
<fred@daisy.cybersouk.com>

   ----- Transcript of session follows -----
... while talking to mail.cybersouk.com.:
>>> RCPT To:<fred@cybersouk.com>
<<< 554 <fred@cybersouk.com>: Recipient address rejected: Relay access denied
554 <fred@daisy.cybersouk.com>... Service unavailable

Author

Commented:
I guewss I use Postfix. I have an /etc/postfix/main.cf file. Done a few changes and guess what? I finally receive mail from outside. :-))

And finally I can send with the cgi script, so all my troubles are gone.

Can't tell you how your guidelines helped. Many thanks.
Top Expert 2005

Commented:
Ah yes, it's not much use changing sendmail files when you aren't using it. But at least it's fixed now.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial