Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


Search this Thread
Old 10-09-2005, 04:27 PM   #1
Registered: May 2004
Distribution: Fedora 4 and Slackware
Posts: 179

Rep: Reputation: 30
Sendmail - not sending mail

Hi, long time linux user, first time attempting to setup a mail server. Basically I want to set up a simple mail server for use by apache / php to send email. Php requires a sendmail server be setup and working on the machine that it is installed on, inorder to send mail properly. I have been playing around with send mail, but to no avail, I cannot send an email. Any ideas, suggestions, help would be appreciated. Here are some of the files that I am using: (from which is generated):
VERSIONID('@(#)  8.13 Linux 10/9/05')
Code:              RELAY
localhost                                         RELAY                                RELAY                                         RELAY
192.168.1                                        RELAY
# Basic system aliases -- these MUST be present.
MAILER-DAEMON:  postmaster
postmaster:     root
# General redirections for pseudo accounts.
bin:            root
daemon:         root
games:          root
ingres:         root
nobody:         root
system:         root
toor:           root
uucp:           root
# Well-known aliases.
manager:        root
dumper:         root
webmaster:      root
abuse:          root
# trap decode to catch security attacks
decode:         root

I have run the "make" command in the /etc/mail directory to ensure that all the .db files are generated correctly and made sure to run "m4 > /etc/mail/" before restarting the server. In addition I have a valid DNS server that aliases to my webserver as well as specifying it as my primary mail server, eg.
" IN MX 10 "

Also on my gateway to the internet, I opened up port 25 for this machine and forward all new requests on port 25 to it.

Like I said, I have not set up a mail server before, so I am probably missing something really big. If so, or if anyone has any ideas please post, I would really appreciate it. Thank you
Old 10-09-2005, 04:48 PM   #2
Registered: Jun 2005
Location: Lilburn, Ga
Distribution: FC5
Posts: 175

Rep: Reputation: 30
Faced with this, I would first try to send mail locally from user to user. Try something like this as root: echo hello |sendmail -v someuser@localhost. If that works, great. If not, inspect the output that spilled onto the screen. You may even need to telnet into yourself on port 25 and play with sendmail. How to do this is on the web.
Remember that sendmail in most distros, as shipped, will niether send nor receive mail from any place other than localhost. One must comment out the Daemon_Options line to make it work on the internet. Well documented all over the web.
Try some of this, you'll track it down.
Old 10-16-2005, 01:26 AM   #3
Registered: May 2004
Distribution: Fedora 4 and Slackware
Posts: 179

Original Poster
Rep: Reputation: 30
Thanks for the reply, GL1800. I tried the following commands:
start the sendmail daemon (as root):
/usr/sbin/sendmail -L sm-mta -bd -q25m
/usr/sbin/sendmail -L sm-msp-queue -Ac -q25m

verify sendmail is running:
netstat -an | grep :25
which displays:
tcp 0 0* LISTEN

Try to send an email:
echo "hi" | sendmail -v root@localhost

I have also replaced the recipient of the email from root to a regular user on my machine. But to no avail, both times, I still get:
user... Connecting to [] via relay... (then after a while: )
user... Deferred: Connection timed out with []

And in my /var/log/messages file:Oct 16 02:06:30 hostname sendmail[14439]: j9G66UO0014439: from=user, size=3, class=0, nrcpts=1, msgid=<>, relay=user@localhost
Oct 16 02:09:35 hostname sm-msp-queue[14437]: j9G5lq4L014358: to=root@localhost, ctladdr=mdev (1001/100), delay=00:21:43, xdelay=00:03:09, mailer=relay, pri=210003, relay=[] [], dsn=4.0.0, stat=Deferred: Connection timed out with []

I am really stumped with this one. I'm sure its not a firewall problem, as I have opened up all ports for the localhost and port 25 both ways for the ip of my mail server. Is there any way to obtain more debugging output? It doesnt even seem that the email is getting to sendmail in the firstplace.
When I send out the email, it it supposed to say (both on standard output and in the log) that im connecting by / using a relay? I have played around with my access file and changed all appearances of the world 'RELAY' to 'OK' but this still does not help. Any ideas?

Last edited by movitto; 10-16-2005 at 01:27 AM.
Old 10-16-2005, 05:48 AM   #4
Registered: Jun 2005
Location: Lilburn, Ga
Distribution: FC5
Posts: 175

Rep: Reputation: 30
Yes, it should say via relay. Wait a second, let me show you one that works, maybe that will help us:

[root@raymondjones ~]# echo hello |sendmail -v Connecting to [] via relay...
220 ESMTP Sendmail 8.13.4/8.13.1; Sun, 16 Oct 2005 06:44:56 -0400
>>> EHLO Hello [], pleased to meet you
250 HELP
>>> MAIL From:<> SIZE=6
250 2.1.0 <>... Sender ok
>>> RCPT To:<>
>>> DATA
250 2.1.5 <>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 j9GAiuhr011951 Message accepted for delivery Sent (j9GAiuhr011951 Message accepted for delivery)
Closing connection to []
>>> QUIT
221 2.0.0 closing connection

See if you can puzzle out what's different there. Also, try to telnet into localhost on port 25, just to make sure you can connect to yourself.
Old 10-21-2005, 09:28 PM   #5
LQ Newbie
Registered: Oct 2005
Posts: 1

Rep: Reputation: 0
I am confused as to why this is not working. I am having the same problem on my RHEL3 updt4. I can send mail to anyone on the local host but outside it does not work. Here is
what I get:

[root@iawana mail]# echo Hello | sendmail -v Name server timeout Transient parse error -- message queued for future delivery queued

I turned off the firewall and it still fails. I have tried many suggestions but with no success.

Old 10-22-2005, 01:20 PM   #6
Registered: May 2004
Distribution: Fedora 4 and Slackware
Posts: 179

Original Poster
Rep: Reputation: 30
I fixed my problem a little while ago (should have posted earlier), and it was a combination of a bunch of things, including bad config files, firewall problems, among other stuff. But anyways, here is a brief list that hopefully should help you solve your problem.

1. First and foremost, make sure your ethernet card is up and running. I know, i know, you may be saying "duh" but after several hours of debugging the localhost, I realized my first problem was that lo was not up and was not assigned :-( It's good to start simple

2. Make sure port 25 is open for both way communication (W->L and L->W) for the machine your running sendmail on. Additionally, make sure that your router is forwarding incoming (W->L) packets on port 25 to your mail server.

3.Make sure your internal DNS service (if you have one) points to that machine for your mail server. You can accomplish this by adding the following line to your zone file for the zone (domain) which you want to run the mail server on:
MX 10 servername_or_ipaddress
This basically tells BIND (if your using something else it may be different) that servername_or_ipaddress is a mail server (as specified by the MX) and gives it a priority of 10. The lower the priority number, the higher the priority. Eg. mail will be routed to a server with priority 10 before it will be routed to a machine with priority 20 (it wont be routed to both, it will one goto the second if the first is down)

4. As for your configuration, it will depend on how you want to set up your site. Here is mine, just to provide you with a place to debug:
VERSIONID('@(#) 8.13 Linux 10/9/05')




access: this file is empty, so technically i probably dont need the access_db and blacklist options in my mc file, but whatever.
alias: unchanged from original

local-host-names: you might be able to get away with only the first, but it cant hurt to have the other 2

All the other files were unchanged

Remember to run m4 > /etc/mail/
as well as a make in the /etc/mail directory after modifying these files.

I hope this helps. I realize sendmail is a pain to configure, definetly among the hardest I've experienced so far. Good luck!
Old 11-24-2005, 03:25 AM   #7
Registered: Aug 2004
Distribution: Fedora, Debian
Posts: 327

Rep: Reputation: 30
Can not receive mail

Thank you so much for the above summary about debug sendmail configuration step by step. This is really helpful

As one of the start learning how to configure sendmail, I was lucky not encounter many big problems yet.

I comment out
#DAEMON_OPTIONS(`Port=smtp,Addr=, Name=MTA')dnl
and edit
dnl define(`SMART_HOST',`')
to let my ISP mail server to handle mails.

I am able to send mail by
echo hello |sendmail -v
or squirrelmail interface. But I can not receive emails.

Please point out the problems. Thank you.

Last edited by fhleung; 11-28-2005 at 06:05 PM.
Old 11-26-2005, 06:44 AM   #8
Registered: Aug 2004
Distribution: Fedora, Debian
Posts: 327

Rep: Reputation: 30
Old 04-11-2007, 12:04 AM   #9
LQ Newbie
Registered: Apr 2007
Posts: 3

Rep: Reputation: 0
Thumbs up legends

You blokes are so on the money its awsome. I have read so many How Tos I've lost track of what i read where and how to impement it. I've also had so many problems with conflicting directories mentioned by different users and manuals that i just got confused to hell and couldn't work out what directories my machine is running on.

The problem for me is, i think, two fold.

To start with i only want my server to handle internal mail. It's NOT but it is quite happy forwarding emails to external servers so i think it has to do with either the MX record or maybe the 'access_db'. How do i rebuild the db file from the access file. I tried 'make' but get an error "no make file found' in the /etc/mail directory.

Where do i define the MX record?

Do i need to: 'define (SMART_HOST......) and if so where?

Another related problem that has eluded me for some time until i read your post was i had Or couldn't find my file. It is actually called for some bizzare reason.

Cheers in advance....


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
sendmail not sending mail dtra Linux - Software 1 06-09-2005 07:47 PM
sending picture with mail/sendmail ziox Linux - Networking 1 01-17-2005 11:56 AM
Sending mail without running Sendmail geomonap Linux - Software 5 12-22-2004 06:34 AM
Sending mail without sendmail geomonap Linux - Security 2 12-21-2004 01:32 AM
sendmail not sending mail clinger Linux - Software 8 07-30-2004 02:29 AM

All times are GMT -5. The time now is 06:05 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration