LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   sendmail unable to send message to external servers (e.g. hotmail,gmail etc) (http://www.linuxquestions.org/questions/linux-networking-3/sendmail-unable-to-send-message-to-external-servers-e-g-hotmail-gmail-etc-889232/)

mali2 06-30-2011 12:43 PM

sendmail unable to send message to external servers (e.g. hotmail,gmail etc)
 
first of all, I am new to mailing server stuff.
Long story in short; I am trying to send an email by sendmail (ubuntu) to external servers, but unable to send.

following is what i am trying to do and what i got the response:

sendmail -v xxx@hotmail/gmail.com < mail.test

where mail.test contains
[COLOR="rgb(105, 105, 105)"]
From: bla@bla.com
Subject: bla bla bla
This is test email.

and this is the reply:

WARNING: local host name (mylab) is not qualified; see cf/README: WHO AM I? xxx@hotmail.com... Connecting to [127.0.0.1] via relay... 220 mylab ESMTP Sendmail 8.14.3/8.14.3/Debian-9.1ubuntu1; Thu, 30 Jun 2011 17:58:52 +0200; (No UCE/UBE) logging access from: localhost.localdomain(OK)-localhost.localdomain [127.0.0.1]......
MAIL From: SIZE=849 AUTH=root@mylab
250 2.1.0 ... Sender ok
-RCPT To:
-DATA
250 2.1.5 ... Recipient ok
354 Enter mail, end with "." on a line by itself
.


and then nothing happened and keep the cursor blinking.

and following information is logged in syslog:

... mailer=es mtp, pri=570307, relay=mx2.hotmail.com. [65.55.37.104], dsn=4.0.0, stat=Deferred: Connection timed out with mx2.hotmail.com.

I also tried

telnet mx1.hotmail.com 25

it stucked at

trying to connect 65.55.37.72...

any idea would be appreciated. Thanks for your concentration.

bathory 06-30-2011 02:21 PM

Hi,

I guess your ISP blocks outgoing traffic to port 25. If you want to be able to send mail outside, you should use the ISP mailserver as a smarthost

Regards

agentbuzz 07-01-2011 12:41 PM

mali2,
bathory is probably right; SMTP sockets from customer premises equipment are firewalled. Now you need to configure sendmail to use your ISP's MTA for outgoing mail.

First ensure that you have SASL support in your sendmail binary:

Code:

Site$ sendmail -d0.1 -bv root | grep SASL
                NAMED_BIND NETINET NETUNIX NEWDB PIPELINING SASLv2 SCANF

If you do not see SASL listed in the output of the above command, compile sendmail with the appropriate lines in your site.config.m4 file, which is found at /usr/src/sendmail-8.14.3/devtools/Site/, or where you put your source code. If there is no site.config.m4 in devtools/Site, then do this:

Code:

$ cd devtools/Site
$ cp ../OS/Linux site.config.m4

You might as well add milter support while you're at it. Open your Makefile and append "libmilter" at the end of the SUBDIRS line:

Code:

SUBDIRS= libsm libsmutil libsmdb sendmail editmap mail.local \
        mailstats makemap praliases rmail smrsh vacation libmilter

This is the relevant part of a known-good site.config.m4. There are more lines below it:

Code:

TRUST_AUTH_MECH(`GSSAPI DIGEST-MD5 LOGIN')dnl
define(`confAUTH_MECHANISMS', `GSSAPI DIGEST-MD5 LOGIN')dnl
define(`confDEF_AUTH_INFO', `/etc/mail/auth/auth-info')dnl
define(`confDEPEND_TYPE', `CC-M')
define(`confSM_OS_HEADER', `sm_os_linux')
define(`confMANROOT', `/usr/man/man')
define(`confLIBS', `-ldl')
define(`confEBINDIR', `/usr/sbin')
APPENDDEF(`confLIBSEARCH', `crypt nsl')
APPENDDEF(`confLIBSEARCH', `crypt nsl')
APPENDDEF(`confENVDEF', `-DSASL=2')
APPENDDEF(`conf_sendmail_LIBS', `-lsasl2')
APPENDDEF(`confLIBDIRS', `-L/usr/local/lib/sasl2')
APPENDDEF(`confINCDIRS', `-I/usr/local/include')
APPENDDEF(`conf_sendmail_ENVDEF', `-DMILTER')
APPENDDEF(`conf_libmilter_ENVDEF', `-D_FFR_MILTER_ROOT_UNSAFE')
define(`confMAPDEF',`-DNEWDB')

Use "./Build -c" at the root of your source tree to do the compile, since you have changed site.config.m4.

Find the "smart host" line in /etc/mail/sendmail.cf and type in your ISP's SMTP hostname:

Code:

# "Smart" relay host (may be null)
DSsmtp.domain.com

There should be a line in sendmail.cf like this:


Code:

# authinfo list database: contains info for authentication as client
Kauthinfo hash /etc/mail/auth/client-info

In your client-info file you should have a line according to this syntax:

Code:

AuthInfo:smtp.domain.com "U:USERNAME" "I:USERNAME" "P:PASSWORD" "M:LOGIN PLAIN"
Then call sendmail like this to watch your SMTP ssession:

Code:

mail:~$ sudo sendmail -Am -v -t
To: jblow@domain.com
From: jblow@domain.com
Subject: boom

here
jblow@domain.com... Connecting to smtp.domain.com via relay...

220 smtp.domain.com ESMTP
>>> EHLO mail.domain.org
250-smtp.domain.com
250-AUTH LOGIN PLAIN XYMCOOKIE
250-PIPELINING
250 8BITMIME
>>> AUTH LOGIN
334 VXNlcm5hbWU6
>>> YkVf5434DvbiQ5v==
334 Sdfd465rbfg
>>> nGt6578trtgtT==
235 OK, go ahead
>>> MAIL From:<user@domain.org> AUTH=user@domain.org
250 OK , completed
>>> RCPT To:<jblow@domain.com>
>>> DATA
250 OK , completed
354 Start Mail. End with CRLF.CRLF
>>> .
250 OK , completed
jblow@domain.com... Sent (OK , completed)
Closing connection to smtp.domain.com
>>> QUIT
221 Service Closing transmission



All times are GMT -5. The time now is 07:30 AM.