LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-30-2010, 07:54 AM   #1
grob115
Member
 
Registered: Oct 2005
Posts: 542

Rep: Reputation: 32
sendmail config


Hello,

Am in need to setup my mail server (ie sendmail/dovcot). My understanding is to do the following for sendmail:
1) Edit sendmail.mc
2) "make"
3) service sendmail restart

The sendmail server will then be listening in for localling executed "mailx" commands, in addition to port 25 for MUA such as Outlook to connect to. However, is it true that my hosting company must provide me with their SMTP server for me to configure in the sendmail.mc file? If not, how would my sendmail knows which address to relay the outgoing mails to?
 
Old 06-30-2010, 08:25 AM   #2
tsg
Member
 
Registered: Mar 2008
Posts: 155

Rep: Reputation: 30
If you're just looking for outgoing mail, sendmail handles that. No need for a relay. Or you can set up the "smart relay" feature which will relay all outgoing (ie, not local) mail to that relay. It depends on how you want to set it up and also whether your ISP allows port 25 traffic to internet servers (many don't to thwart spammers).

In order to get incoming mail, you either need an MX DNS record pointing to the public IP address of the machine running sendmail, or a means of getting the mail from whatever machine is designated as the mail server for your domain (eg your ISP's smtp server) such as fetchmail.
 
Old 06-30-2010, 10:33 AM   #3
grob115
Member
 
Registered: Oct 2005
Posts: 542

Original Poster
Rep: Reputation: 32
Basically I'll have a standalone server acting as the SMTP/Dovcot server. The SMTP part will accept mail from other servers issuing "mailx" commands, and MUA such as Outlook. Is the following true:
1) The line "DS" in sendmail.mc is for setting the next SMTP server to relay mail to, after receiving mails from the other servers' mailx commands and MUA clients. In this case, if the mail server is the last MTA in our domain, we don't need to specify any SMTP servers on the "DS" line in sendmail.mc.

2) The file /etc/resolv.conf needs to have an entry for the DNS server. This name server is then used by sendmail, acting as the last MTA in the domain, to query for IPs of the next MTA to send the e-mails to.
 
Old 06-30-2010, 11:04 AM   #4
tsg
Member
 
Registered: Mar 2008
Posts: 155

Rep: Reputation: 30
Quote:
Originally Posted by grob115 View Post
Basically I'll have a standalone server acting as the SMTP/Dovcot server. The SMTP part will accept mail from other servers issuing "mailx" commands, and MUA such as Outlook. Is the following true:
1) The line "DS" in sendmail.mc is for setting the next SMTP server to relay mail to, after receiving mails from the other servers' mailx commands and MUA clients. In this case, if the mail server is the last MTA in our domain, we don't need to specify any SMTP servers on the "DS" line in sendmail.mc.
If this server is going to be responsible for sending the outgoing mail on to the recipients smtp server, then you don't need to set DS.

Quote:
2) The file /etc/resolv.conf needs to have an entry for the DNS server. This name server is then used by sendmail, acting as the last MTA in the domain, to query for IPs of the next MTA to send the e-mails to.
Correct.
 
Old 07-03-2010, 11:00 AM   #5
grob115
Member
 
Registered: Oct 2005
Posts: 542

Original Poster
Rep: Reputation: 32
Um... it's not working. Did the following:
1) Ensure the line "nameserver 192.168.10.1" is in my "etc/resolv.conf"
2) Ensure "host www.yahoo.com 192.168.10.1" is resolving an IP
3) Execute "echo "body" | mailx -s "subject" root <address>@hotmail.com

While I can see the mail sent at step 3 in /var/spool/mail/root, I can't see it in the hotmail account. In fact, it's stuck in the mailq. If I "ls /var/spool/mqueue", I can see two files created. One file contains the body and the other contains the header.

Also tried the following but noticed no difference:
1) Add the hostname returned by "hostname" command to /etc/mail/access
2) Execute "makemap hash access < access"
3) Execute "service sendmail restart"

What else am I missing? I simply want to use the "mailx" command to send mail to a normal e-mail address.
 
Old 07-03-2010, 11:13 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Take a look at /var/log/maillog to see why the mail is not delivered
 
Old 07-03-2010, 11:28 AM   #7
grob115
Member
 
Registered: Oct 2005
Posts: 542

Original Poster
Rep: Reputation: 32
Each time I try to send a mail, it gives something like the following block.

Code:
Jul  3 01:37:09 test sendmail[5237]: alias database /etc/aliases rebuilt by root
Jul  3 01:37:09 test sendmail[5237]: /etc/aliases: 76 aliases, longest 10 bytes, 765 bytes total
Jul  3 01:37:09 test sendmail[5242]: starting daemon (8.13.8): SMTP+queueing@01:00:00
Jul  3 01:37:10 test sm-msp-queue[5251]: starting daemon (8.13.8): queueing@01:00:00
Jul  3 01:39:50 test sendmail[5266]: o638doJa005266: from=root, size=55, class=0, nrcpts=2, msgid=<201007030839.o638doJa005266@test.home.com>, relay=root@localhost
Jul  3 01:39:50 test sendmail[5267]: o638doGj005267: from=<root@test.home.com>, size=346, class=0, nrcpts=2, msgid=<201007030839.o638doJa005266@test.home.com>, proto=ESMTP, daemon=MTA, relay=[127.0.0.1]
Jul  3 01:39:50 test sendmail[5266]: o638doJa005266: to=root,<addr>@hotmail.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=60055, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o638doGj005267 Message accepted for delivery)
Jul  3 01:39:50 test sendmail[5268]: o638doGj005267: to=<root@test.home.com>, ctladdr=<root@test.home.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=60525, dsn=2.0.0, stat=Sent
 
Old 07-03-2010, 11:38 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Jul 3 01:39:50 test sendmail[5266]: o638doJa005266: to=root,<addr>@hotmail.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=60055, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o638doGj005267 Message accepted for delivery)
From the above it looks like localhost is considered the mailserver of hotmail.com!!! What gives:
Code:
sendmail -bv whatever@hotmail.com
 
Old 07-03-2010, 11:49 AM   #9
grob115
Member
 
Registered: Oct 2005
Posts: 542

Original Poster
Rep: Reputation: 32
[root@test mail]# sendmail -bv whatever@hotmail.com
whatever@hotmail.com... deliverable: mailer esmtp, host hotmail.com., user whatever@hotmail.com
 
Old 07-03-2010, 11:58 AM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
That's correct.
From a terminal run
Code:
tail -f /var/log/maillog
From another one try to send directly to hotmail:
Code:
mailx -s "Test" addr@hotmail.com < /dev/null
and watch the output of the 1st command.
 
Old 07-03-2010, 12:10 PM   #11
grob115
Member
 
Registered: Oct 2005
Posts: 542

Original Poster
Rep: Reputation: 32
It gives the following. How can I tell from these lines that it thinks it's the mail server for hotmail?
Code:
Jul  3 03:07:25 test sendmail[5590]: o63A7PMZ005590: from=root, size=36, class=0, nrcpts=1, msgid=<201007031007.o63A7PMZ005590@test.home.com>, relay=root@localhost
Jul  3 03:07:25 test sendmail[5591]: o63A7PAQ005591: from=<root@test.home.com>, size=327, class=0, nrcpts=1, msgid=<201007031007.o63A7PMZ005590@test.home.com>, proto=ESMTP, daemon=MTA, relay=[127.0.0.1]
Jul  3 03:07:25 test sendmail[5590]: o63A7PMZ005590: to=addr@hotmail.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30036, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o63A7PAQ005591 Message accepted for delivery)
In fact it keeps logging a line like the following.
Code:
Jul  3 03:04:31 test sendmail[5130]: o638SVkc005129: to=<addr@hotmail.com>, ctladdr=<root@test.home.com> (0/0), delay=01:36:00, xdelay=01:36:00, mailer=esmtp, pri=60531, relay=mx2.hotmail.com. [65.55.37.88], dsn=4.0.0, stat=Deferred: Connection timed out with mx2.hotmail.com.
 
Old 07-03-2010, 12:22 PM   #12
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
In fact it keeps logging a line like the following.
Code:

Jul 3 03:04:31 test sendmail[5130]: o638SVkc005129: to=<addr@hotmail.com>, ctladdr=<root@test.home.com> (0/0), delay=01:36:00, xdelay=01:36:00, mailer=esmtp, pri=60531, relay=mx2.hotmail.com. [65.55.37.88], dsn=4.0.0, stat=Deferred: Connection timed out with mx2.hotmail.com.
So it can connect to hotmail mailserver. Most likely you need to use a smarthost because your ISP blocks port 25.
Add ISP mailserver after the DS in sendmail.cf (like DSmail.isp.com), restart sendmail and check again. Could be that you have to authenticate first in your ISP's mailserver.
 
Old 07-03-2010, 12:31 PM   #13
grob115
Member
 
Registered: Oct 2005
Posts: 542

Original Poster
Rep: Reputation: 32
OMG! That's it! The ISP does require setting a password on our broadband router to access Internet and I bet you the same for e-mail. Currently I use smtp.spamarrest.com so my Outlook doesn't have the same problem.

However, my attempt to send via smtp.spamarrest.com also failed previously as they don't use the standard port 25 and I'm not sure whether I did set it correctly. You can see my attempt at doing this here. That was on a FC11.

I've since wiped the FC11 with a new CentOS 5.5. I'm actually doing this to test the sendmail setup for my webserver. I guess it'd be no problem on the actual webserver as the hosting company shouldn't have blocked outgoing port 25?
 
Old 07-03-2010, 12:42 PM   #14
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
It been a long time that I've made a similar setup, but IIRC you have to use the following in sendmail.mc
Code:
define(`SMART_HOST',`relay:smtp.spamarrest.com')dnl
define(`RELAY_MAILER',`esmtp')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
 
Old 07-03-2010, 01:19 PM   #15
grob115
Member
 
Registered: Oct 2005
Posts: 542

Original Poster
Rep: Reputation: 32
Thanks will give it a try.
 
  


Reply



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 config andy.l Linux - Server 3 05-08-2010 05:38 AM
Sendmail config questions + Sendmail not reflecting changes to access db wbuik Linux - Networking 2 03-26-2009 05:02 AM
Sendmail - Config for IP Block's & Config Issues Thom_Redhat Linux - Software 1 04-07-2006 01:29 PM
sendmail config help gw1500se Mandriva 2 12-31-2005 08:48 PM
Sendmail config ericthyred Linux - Software 7 04-15-2004 06:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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

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