I have searched this forum extensively and can't seem to find a workable solution to my sendmail issue, but that could be down to my own lack of knowledge so please bear with me...
I am using a Sun Solaris 9 box to try and send e-mail to external addresses. The Unix box is not an e-mail server. Our e-mail is done through a third party ISP i.e. POP3 accounts, complete with user names and passwords.
I'm using sendmail version 8.12.2+Sun and I have made a number of changes (rightly or wrongly) to /etc/mail/sendmail.cf & /etc/init.d/sendmail based on details found on
www.kempston.net.
The problem I'm having is this.
When I send a mail to my external address the mail is queued, I can see it in mailq, but it never gets sent.
I can telnet onto port 25 and can see sendmail is running.
I can also see send mail running when I us "ps".
root 5392 1 0 12:13:45 ? 0:00 /usr/lib/sendmail -bd -X /var/log/mail.log -oL9
smmsp 5393 1 0 12:13:45 ? 0:00 /usr/lib/sendmail -Ac -q15m
NOTE: I edited /etc/init.d/sendmail to add the "-X /var/log/mail.log" line ...
The changes to the /etc/mail/sendmail.cf are as follows:
! # "Smart" relay host (may be null)
! DSmailhost$?m.$m$.
Changed to read.....
! # "Smart" relay host (may be null)
! DSmail.mailhost.com
Where mail.mailhost.com is the SMTP server.
! # avoid connecting to "expensive" mailers on initial submission?
! O HoldExpensive=False
Changed to read ......
! # avoid connecting to "expensive" mailers on initial submission?
! O HoldExpensive=True
Added in an entry to read ......
- # Don't Use DNS
- O ResolverOptions=-DNSRCH
Also changed line .....
! Mrelay, P=[IPC], F=mDFMuXa8, S=EnvFromSMTP/HdrFromSMTP, R=MasqSMTP, E=\r\n, L=2040,
Added in "e" after "F=".....
! Mrelay, P=[IPC], F=emDFMuXa8, S=EnvFromSMTP/HdrFromSMTP, R=MasqSMTP, E=\r\n, L=2040,
And also added in rule S11 ....
- S11
- R$* $@ me@domain.com
Where
me@domain.com is my actual e-mail address .....
I have also edited the /etc/hosts file to include:
xxx.xxx.x.x servername servername.domain loghost
Where the domain part is the text after the @ of my mail address, the IP is local.
And also added
xxx.xx.xx.x mail.mymailhost.com mailhost
Where the mymailhost is the SMTP server and the IP is the primary DNS IP
When I run the following command:
/usr/lib/sendmail -d0.1 -bt < /dev/null
I get the following output ...
# /usr/lib/sendmail -d0.1 -bt < /dev/null
Version 8.12.2+Sun
Compiled with: DNSMAP LDAPMAP LOG MAP_REGEX MATCHGECOS MILTER MIME7TO8 MIME8TO7 NAMED_BIND NDBM NETINET NETINET6 NETUNIX NEWDB NIS NISPLUS PIPELINING SCANF USERDB XDEBUG
============ SYSTEM IDENTITY (after readcf) ============
(short domain name) $w = servername
(canonical domain name) $j = servername.domain
(subdomain name) $m = domain
(node name) $k = servername
========================================================
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
I have been testing this with the following simple script:
# more send_mail
SUBJ="Send mail from Unix with file attachments"
TO=me@domain.com
(
cat << !
To : ${TO}
Subject : ${SUBJ}
!
cat << !
HOPE THIS WORKS
you got the mail from sendmail utility
!
uuencode test.txt test.txt
) | /usr/lib/sendmail -v ${TO} ${CC}
#
Which produces the following output:
me@domain.com... Connecting to localhost via relay...
220 servername.domain ESMTP Sendmail 8.12.2+Sun/8.12.2; Tue, 9 Jan 2007 14:30:09 GMT
>>> EHLO servername.domain
250-servername.domain Hello localhost [xxx.x.x.x], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<me@servername.domain> SIZE=194
250 2.1.0 <me@servername.domain>... Sender ok
>>> RCPT To:<me@domain.com>
>>> DATA
250 2.1.5 <me@domain.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 l09EU9aE007093 Message accepted for delivery
me@comain.com... Sent (l09EU9aE007093 Message accepted for delivery)
Closing connection to localhost
>>> QUIT
221 2.0.0 servername.domain closing connection
The mailq produces the following:
# mailq
/var/spool/mqueue (1 request)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
l09EU9aE007093 122 Tue Jan 9 14:30 <me@servername.domain>
<me@domain.com>
Total requests: 1
#
The log file /var/log/mail.log looks like this:
# more mail.log
07093 >>> 220 servername.domain ESMTP Sendmail 8.12.2+Sun/8.12.2; Tue, 9 Jan 2007 14:30:
09 GMT
07093 <<< EHLO servername.domain
07093 >>> 250-servername.domain Hello localhost [xxx.x.x.x], pleased to meet you
07093 >>> 250-ENHANCEDSTATUSCODES
07093 >>> 250-PIPELINING
07093 >>> 250-EXPN
07093 >>> 250-VERB
07093 >>> 250-8BITMIME
07093 >>> 250-SIZE
07093 >>> 250-DSN
07093 >>> 250-ETRN
07093 >>> 250-DELIVERBY
07093 >>> 250 HELP
07093 <<< MAIL From:<me@servername.domain> SIZE=194
07093 >>> 250 2.1.0 <me@servername.domain>... Sender ok
07093 <<< RCPT To:<me@domain.com>
07093 >>> 250 2.1.5 <me@domain.com>... Recipient ok
07093 <<< DATA
07093 >>> 354 Enter mail, end with "." on a line by itself
07093 <<< Received: (from root@localhost)
07093 <<< by servername.domain (8.12.2+Sun/8.12.2/Submit) id l09EU9h8007089
07093 <<< for me@domain.com; Tue, 9 Jan 2007 14:30:09 GMT
07093 <<< Date: Tue, 9 Jan 2007 14:30:09 GMT
07093 <<< From: me@servername.domain
07093 <<< Message-Id: <200701091430.l09EU9h8007089@servername.domain>
07093 <<< To: me@domain.com
07093 <<< Subject: Send mail from Unix with file attachments
07093 <<<
07093 <<< HOPE THIS WORKS
07093 <<< you got the mail from sendmail utility
07093 <<< begin 444 test.txt
07093 <<< >5&AI<R!I<R!A('1E<W0@;6%I;"!F<F]M($ME;BX*
07093 <<<
07093 <<< end
07093 <<< .
07093 >>> 250 2.0.0 l09EU9aE007093 Message accepted for delivery
07093 <<< QUIT
07093 >>> 221 2.0.0 servername.domain closing connection
I can see the message in queued in /var/spool/mqueue
So why is it not reaching the destination e-mail account?
What am I missing?