LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Simple sendmail configuration (https://www.linuxquestions.org/questions/linux-server-73/simple-sendmail-configuration-638142/)

Fernandoch 04-27-2008 04:47 AM

Simple sendmail configuration
 
Hello,

I want my server to be able to send emails. It is a Cent OS 5.1

When I try to send an email I get this error in /var/log/maillog:

Apr 27 11:29:50 localhost sendmail[3317]: m3R9CX14003315: to=<marcb@gmail.com>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:17:17, xdelay=00:17:17, mailer=esmtp, pri=120567, relay=gmail.com., dsn=4.0.0, stat=Deferred: Name server: gmail.com.: host name lookup failure

What could I have done wrong?

I open sendmail.mc and modify just these lines following a manual:

I changed this line

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

to

DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl

and this line

FEATURE(`accept_unresolvable_domains')dnl

to this line

dnl FEATURE(`accept_unresolvable_domains')dnl

Then I ran

make -C /etc/mail

and service sendmail start

Any clues of what could be wrong?

jakev383 04-27-2008 05:26 AM

Quote:

Originally Posted by Fernandoch (Post 3134321)
Hello,

I want my server to be able to send emails. It is a Cent OS 5.1

When I try to send an email I get this error in /var/log/maillog:

Apr 27 11:29:50 localhost sendmail[3317]: m3R9CX14003315: to=<marcb@gmail.com>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:17:17, xdelay=00:17:17, mailer=esmtp, pri=120567, relay=gmail.com., dsn=4.0.0, stat=Deferred: Name server: gmail.com.: host name lookup failure

What could I have done wrong?

I don't know much about sendmail itself, but it says you're getting a host name lookup failure which will be DNS. Your machine may not be looking the name up successfully. Can you resolve gmail.com from the CLI?

Fernandoch 04-27-2008 05:32 AM

I have no dns setup. I just connect to the internet through a router. Is that ok?

Check this ping:

[root@localhost etc]# ping gmail.com
PING gmail.com (64.233.161.83) 56(84) bytes of data.
64 bytes from gmail.com (64.233.161.83): icmp_seq=1 ttl=242 time=62.2 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=2 ttl=242 time=26.5 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=3 ttl=242 time=48.6 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=4 ttl=242 time=27.0 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=5 ttl=242 time=39.2 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=6 ttl=242 time=31.5 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=7 ttl=242 time=29.4 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=8 ttl=242 time=29.0 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=9 ttl=242 time=38.1 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=10 ttl=242 time=29.0 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=11 ttl=242 time=41.1 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=12 ttl=242 time=37.1 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=13 ttl=242 time=35.6 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=14 ttl=242 time=37.6 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=15 ttl=242 time=62.5 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=16 ttl=242 time=69.4 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=17 ttl=242 time=52.1 ms
64 bytes from gmail.com (64.233.161.83): icmp_seq=18 ttl=242 time=31.0 ms

blacky_5251 04-27-2008 06:54 AM

It may be your network connection - i.e. dynamic DNS? If you use Dynamic DNS for your domain, then many email systems will reject email from you based on your server's public (and dynamic) IP address.

Are you using a SMART HOST? Using your ISP to send email is the way to avoid the problem I've just outlined. Your ISP will have a static IP address that other servers will "respect" and accept email from.

BTW: I prefer Postfix and would recommend you use it instead of Sendmail.

PS: It could also be that your server's hostname is incorrectly set for interacting publicly. The log message says your email is from root@localhost.localdomain which is OK in private, but no good when dealing with other servers like gmail.

Fernandoch 04-27-2008 12:49 PM

Yes, I have dynamic DNS. Does that mean sendmail needs a fixed IP to work?

What is smart host?

Not having a hostname is also a problem for sendmail?

blacky_5251 04-27-2008 04:43 PM

Hi,

Sendmail and Postfix don't require a fixed IP to "work", but some major email systems will reject email from IP addresses that are assigned dynamically. They do this because they "assume" that the email is being sent from a spambot, not from a correctly configured email server. This is an anti-spam measure and discriminates against those of us using dynamic DNS for our servers.

The solution though is SMART HOST. This is where you relay all out-bound email through your ISP's email server rather than sending the message directly. For example, if I sent an email to you, my server would send the message to my ISP first, who then sends it to your server.

Having said that, I still think the problem lies with your domain name settings in Sendmail. Sendmail is sending messages from "root@localhost.localdomain" and that won't work. It must be "root@your.domain.com" or whatever your domain name is.

Good luck.


All times are GMT -5. The time now is 11:44 AM.