LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 10-09-2005, 04:27 PM   #1
movitto
Member
 
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:

sendmail.mc (from which sendmail.cf is generated):
Code:
divert(0)
include(`/usr/share/sendmail/cf/m4/cf.m4')
VERSIONID('@(#)sendmail.mc  8.13 Linux 10/9/05')
OSTYPE(`linux')
FEATURE(`access_db')
MAILER(local)
MAILER(smtp)
/etc/mail/access:
Code:
localhost.mydomain.net              RELAY
localhost                                         RELAY
mydomain.net                                RELAY
127.0.0.1                                         RELAY
192.168.1                                        RELAY
/etc/mail/aliases:
Code:
# 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
/etc/mail/local-host-names:
Code:
mydomain.net
mail.mydomain.net

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 sendmail.mc > /etc/mail/sendmail.cf" before restarting the server. In addition I have a valid DNS server that aliases mail.mydomain.net to my webserver as well as specifying it as my primary mail server, eg.
" IN MX 10 mail.mydomain.net "

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
GL1800
Member
 
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
movitto
Member
 
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 0.0.0.0:25 0.0.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 [127.0.0.1] via relay... (then after a while: )
user... Deferred: Connection timed out with [127.0.0.1]

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=<200510160606.j9G66UO0014439@mydomain.net>, 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=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection timed out with [127.0.0.1]

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
GL1800
Member
 
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 ray@raymondjones.net
ray@raymondjones.net... Connecting to [127.0.0.1] via relay...
220 raymondjones.net ESMTP Sendmail 8.13.4/8.13.1; Sun, 16 Oct 2005 06:44:56 -0400
>>> EHLO raymondjones.net
250-raymondjones.net Hello raymondjones.net [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> MAIL From:<root@raymondjones.net> SIZE=6 AUTH=root@raymondjones.net
250 2.1.0 <root@raymondjones.net>... Sender ok
>>> RCPT To:<ray@raymondjones.net>
>>> DATA
250 2.1.5 <ray@raymondjones.net>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 j9GAiuhr011951 Message accepted for delivery
ray@raymondjones.net... Sent (j9GAiuhr011951 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 raymondjones.net 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
wg174020
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 wgoll@lionel.com
lionel.com: Name server timeout
wgoll@lionel.com... Transient parse error -- message queued for future delivery
wgoll@lionel.com... queued

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

help
 
Old 10-22-2005, 01:20 PM   #6
movitto
Member
 
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 127.0.0.1 :-( 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:
sendmail.mc:
divert(0)
include(`/usr/share/sendmail/cf/m4/cf.m4')
VERSIONID('@(#)sendmail.mc 8.13 Linux 10/9/05')
OSTYPE(`linux')

MASQUERADE_AS(`your domain.net')
FEATURE(`masquerade_envelope')

FEATURE(`access_db')
FEATURE(`blacklist_recipients')
FEATURE(`use_cw_file')

MAILER(local)
MAILER(smtp)
MAILER(uucp)

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
yourdomain.net
mailservername.yourdomain.net
mail.yourdomain.net

All the other files were unchanged

Remember to run m4 sendmail.mc > /etc/mail/sendmail.cf
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
fhleung
Member
 
Registered: Aug 2004
Distribution: Lubuntu Live OS
Posts: 432

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
Code:
#DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
and edit
Code:
dnl define(`SMART_HOST',`mail.myISP.com')
to let my ISP mail server to handle mails.

I am able to send mail by
Code:
echo hello |sendmail -v something@gmail.com
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
fhleung
Member
 
Registered: Aug 2004
Distribution: Lubuntu Live OS
Posts: 432

Rep: Reputation: 30
bump
 
Old 04-11-2007, 12:04 AM   #9
stpurno
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 sendmail.mc file. It is actually called config.mc for some bizzare reason.

Cheers in advance....
 
Old 09-19-2014, 03:23 AM   #10
fhleung
Member
 
Registered: Aug 2004
Distribution: Lubuntu Live OS
Posts: 432

Rep: Reputation: 30
Still looking for answers
 
  


Reply


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:17 AM.

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