LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   sendmail configuration (https://www.linuxquestions.org/questions/linux-newbie-8/sendmail-configuration-4175484519/)

sachin.davra 11-14-2013 01:25 AM

sendmail configuration
 
Hi,

I wanna configure sendmail in centos 6. I want to enable forward mails to mail relay. how to do it?

TenTenths 11-14-2013 02:29 AM

Look in your sendmail.cf
Look for the lines:
Code:

# "Smart" relay host (may be null)
DS

Put the hostname of your relay host after the DS
If you are using an IP put it in []
Restart sendmail

sachin.davra 11-14-2013 03:15 AM

Quote:

Originally Posted by TenTenths (Post 5064121)
Look in your sendmail.cf
Look for the lines:
Code:

# "Smart" relay host (may be null)
DS

Put the hostname of your relay host after the DS
If you are using an IP put it in []
Restart sendmail

sorry, i could not find this option in sendmail.mc

linuxlover.chaitanya 11-14-2013 03:18 AM

He was asking you to look into sendmail.cf though I would like to disagree on changing sendmail.cf manually.
In sendmail.mc file, you should have something like this

Code:

define(`SMART_HOST', `[RELAY_HOST_IP]')dnl
You will need to generate a new sendmail.cf using m4 macro and restart the service for changes to take effect.

TenTenths 11-14-2013 03:27 AM

Quote:

Originally Posted by linuxlover.chaitanya (Post 5064139)
He was asking you to look into sendmail.cf though I would like to disagree on changing sendmail.cf manually.

I must be "old-school", I've never bothered with sendmail.mc :) You're prefectly right though, your method does make more sense.

sachin.davra 11-14-2013 03:28 AM

Quote:

Originally Posted by linuxlover.chaitanya (Post 5064139)
He was asking you to look into sendmail.cf though I would like to disagree on changing sendmail.cf manually.
In sendmail.mc file, you should have something like this

Code:

define(`SMART_HOST', `[RELAY_HOST_IP]')dnl
You will need to generate a new sendmail.cf using m4 macro and restart the service for changes to take effect.

Thnx for quick reply.

i have done it but still not able to send mail.

druuna 11-14-2013 03:31 AM

Quote:

Originally Posted by sachin.davra (Post 5064147)
Thnx for quick reply.

i have done it but still not able to send mail.

As stated in the other thread about this: You need to set up both side to make it work.

Firerat 11-14-2013 03:34 AM

have you restarted the sendmail service?

how are you testing it?

sachin.davra 11-14-2013 03:38 AM

Quote:

Originally Posted by Firerat (Post 5064150)
have you restarted the sendmail service?

how are you testing it?

Yes i have restarted the service after generating new sendmail.cf

for sending mail using mailx, i have configured sendmail.
installed sendmail and then define('SMART_HOST', '192.168.0.X')dnl
and
dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

Please tell me if i have to change something else also.

sachin.davra 11-14-2013 04:40 AM

Below are the logs if i am trying to send mail using mailx. when i have configured sendmail in one system.
note:- i am using only one system to configure sendmail and sending the mail. mail relay is configured in remote host and i have done the entry in my sendmail.mc
define('SMART_HOST', '192.168.0.125')dnl

Please suggest something to work around this.

Nov 14 16:02:54 GAIDL-5001 sendmail[16907]: rAEAWs7v016907: from=root, size=1099, class=0, nrcpts=1, msgid=<201311141032.rAEAWs7v016907@GAIDL-5001.gai.net>, relay=root@localhost
Nov 14 16:02:54 GAIDL-5001 postfix/smtpd[16908]: connect from localhost[127.0.0.1]
Nov 14 16:02:54 GAIDL-5001 postfix/smtpd[16908]: C97FE1A05AF: client=localhost[127.0.0.1]
Nov 14 16:02:54 GAIDL-5001 postfix/cleanup[16911]: C97FE1A05AF: message-id=<201311141032.rAEAWs7v016907@GAIDL-5001.gai.net>
Nov 14 16:02:54 GAIDL-5001 postfix/qmgr[2614]: C97FE1A05AF: from=<root@GAIDL-5001.gai.net>, size=1578, nrcpt=1 (queue active)
Nov 14 16:02:54 GAIDL-5001 sendmail[16907]: rAEAWs7v016907: to=sachin.davra@gmail.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31099, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as C97FE1A05AF)
Nov 14 16:02:54 GAIDL-5001 postfix/smtpd[16908]: disconnect from localhost[127.0.0.1]
Nov 14 16:02:56 GAIDL-5001 postfix/smtp[16912]: connect to gmail-smtp-in.l.google.com[2a00:1450:4008:c01::1b]:25: Network is unreachable
Nov 14 16:02:56 GAIDL-5001 postfix/smtp[16912]: connect to gmail-smtp-in.l.google.com[74.125.129.27]:25: Connection refused
Nov 14 16:02:56 GAIDL-5001 postfix/smtp[16912]: connect to alt1.gmail-smtp-in.l.google.com[2a00:1450:4008:c01::1b]:25: Network is unreachable
Nov 14 16:02:56 GAIDL-5001 postfix/smtp[16912]: connect to alt1.gmail-smtp-in.l.google.com[74.125.142.27]:25: Connection refused
Nov 14 16:02:56 GAIDL-5001 postfix/smtp[16912]: connect to alt2.gmail-smtp-in.l.google.com[2607:f8b0:4002:c01::1a]:25: Network is unreachable
Nov 14 16:02:56 GAIDL-5001 postfix/smtp[16912]: C97FE1A05AF: to=<sachin.davra@gmail.com>, relay=none, delay=1.3, delays=0.08/0/1.3/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[2607:f8b0:4002:c01::1a]:25: Network is unreachable)

linuxlover.chaitanya 11-14-2013 04:54 AM

Please check the last line in the logs. It says network is unreachable.

TenTenths 11-14-2013 04:54 AM

Quote:

Originally Posted by sachin.davra (Post 5064183)
i have done the entry in my sendmail.mc
define('SMART_HOST', '192.168.0.125')dnl

Did you re-build the sendmail.cf? Check in the sendmail.cf file and look for the DS line and ensure it has your relay host details.

sachin.davra 11-14-2013 06:01 AM

Quote:

Originally Posted by TenTenths (Post 5064188)
Did you re-build the sendmail.cf? Check in the sendmail.cf file and look for the DS line and ensure it has your relay host details.

i checked my sendmail.cf but DS line has no ip or host name then i write ip address of relay host and restarted the service. but still i am getting same error. may be i am doing some less work to get it worked. if you need some more logs plz tell me i will provide it.

TenTenths 11-14-2013 06:18 AM

Post the line that begins
Code:

DS
from your sendmail.cf

druuna 11-14-2013 07:03 AM

I just noticed this:
Quote:

ov 14 16:02:54 GAIDL-5001 sendmail[16907]: rAEAWs7v016907: from=root, size=1099, class=0, nrcpts=1, msgid=<201311141032.rAEAWs7v016907@GAIDL-5001.gai.net>, relay=root@localhost
Nov 14 16:02:54 GAIDL-5001 postfix/smtpd[16908]: connect from localhost[127.0.0.1]
Nov 14 16:02:54 GAIDL-5001 postfix/smtpd[16908]: C97FE1A05AF: client=localhost[127.0.0.1]
.
.
.
Which MTA are you actually using?

I do believe that CentOS 6, like RHEL 6, uses postfix as the default MTA.


All times are GMT -5. The time now is 04:00 PM.