Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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)
# 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
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.
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?
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.
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.
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')
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!
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.