[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

sendmail not sending

Posted on 2004-04-19
11
Medium Priority
?
2,961 Views
Last Modified: 2013-12-06
I am having problems sending mail in PHP code.
It apparently uses the system sendmail command, so I'm looking at that.
Below are commands sending email to 3 different addresses:
myUsername@zzz.com, myUsername@hotmail.com, myUsername@uuu.edu
and the output response, which gives no indication of errors.
But the email is not received by  myUsername@hotmail.com, myUsername@uuu.edu,
only myUsername@zzz.com.
zzz.com is my ISP which i dial into, but i can also dial in to uuu.edu,
and it doesn't seem to make a difference.

What is going on?

------------------------------------------------------------------------
/var/log/maillog for myUsername@hotmail.com:

Apr 19 09:07:31 myUsername sendmail[2164]: i3JF7VkR002164: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31335, dsn=2.0.0, stat=Sent
Apr 19 09:08:19 myUsername sendmail[2175]: i3JF8Jr4002175: from=apache, size=29, class=0, nrcpts=1, msgid=<200404191508.i3JF8Jr4002175@myUsername.mydomain>, relay=root@localhost
Apr 19 09:08:20 myUsername sendmail[2177]: i3JF8JkR002177: from=<apache@myUsername.mydomain>, size=318, class=0, nrcpts=1, msgid=<200404191508.i3JF8Jr4002175@myUsername.mydomain>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Apr 19 09:08:20 myUsername sendmail[2175]: i3JF8Jr4002175: to=myUsername@hotmail.com, delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30029, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (i3JF8JkR002177 Message accepted for delivery)
Apr 19 09:08:24 myUsername sendmail[2179]: i3JF8JkR002177: to=<myUsername@hotmail.com>, delay=00:00:04, xdelay=00:00:04, mailer=esmtp, pri=30289, relay=mx1.hotmail.com. [65.54.252.99], dsn=2.0.0, stat=Sent ( <200404191508.i3JF8Jr4002175@myUsername.mydomain> Queued mail for delivery)

----------------------------------------------------------------------
/var/log/maillog for myUsername@uuu.edu:

Apr 19 09:37:51 myUsername sendmail[12682]: i3JFbo7p012682: from=apache, size=29, class=0, nrcpts=1, msgid=<200404191537.i3JFbo7p012682@myUsername.mydomain>, relay=root@localhost
Apr 19 09:37:51 myUsername sendmail[12685]: i3JFbpkR012685: from=<apache@myUsername.mydomain>, size=311, class=0, nrcpts=1, msgid=<200404191537.i3JFbo7p012682@myUsername.mydomain>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Apr 19 09:37:51 myUsername sendmail[12682]: i3JFbo7p012682: to=myUsername@uuu.edu, delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30029, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (i3JFbpkR012685 Message accepted for delivery)
Apr 19 09:37:53 myUsername sendmail[12687]: i3JFbpkR012685: to=<myUsername@uuu.edu>, delay=00:00:02, xdelay=00:00:02, mailer=esmtp, pri=30282, relay=dns1.uuu.edu. [128.123.3.5], dsn=5.6.0, stat=Data format error
Apr 19 09:37:53 myUsername sendmail[12687]: i3JFbpkR012685: i3JFbrkR012687: DSN: Data format error
Apr 19 09:37:53 myUsername sendmail[12687]: i3JFbrkR012687: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31335, dsn=2.0.0, stat=Sent

---------------------------------------------------------------------

# date | sendmail -f apache -v myUsername@zzz.com
myUsername@zzz.com... Connecting to [127.0.0.1] via relay...
220 myUsername.mydomain ESMTP Sendmail 8.12.8/8.12.8; Mon, 19 Apr 2004 09:05:30 -0600
>>> EHLO myUsername.mydomain
250-myUsername.mydomain Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<apache@myUsername.mydomain> SIZE=29
250 2.1.0 <apache@myUsername.mydomain>... Sender ok
>>> RCPT To:<myUsername@zzz.com>
>>> DATA
250 2.1.5 <myUsername@zzz.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 i3JF5UkR002136 Message accepted for delivery
myUsername@zzz.com... Sent (i3JF5UkR002136 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 myUsername.mydomain closing connection

# date | sendmail -f apache -v myUsername@uuu.edu
myUsername@uuu.edu... Connecting to [127.0.0.1] via relay...
220 myUsername.mydomain ESMTP Sendmail 8.12.8/8.12.8; Mon, 19 Apr 2004 09:07:29 -0600
>>> EHLO myUsername.mydomain
250-myUsername.mydomain Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<apache@myUsername.mydomain> SIZE=29
250 2.1.0 <apache@myUsername.mydomain>... Sender ok
>>> RCPT To:<myUsername@uuu.edu>
>>> DATA
250 2.1.5 <myUsername@uuu.edu>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 i3JF7TkR002162 Message accepted for delivery
myUsername@uuu.edu... Sent (i3JF7TkR002162 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 myUsername.mydomain closing connection

# date | sendmail -f apache -v myUsername@hotmail.com
myUsername@hotmail.com... Connecting to [127.0.0.1] via relay...
220 myUsername.mydomain ESMTP Sendmail 8.12.8/8.12.8; Mon, 19 Apr 2004 09:08:19 -0600
>>> EHLO myUsername.mydomain
250-myUsername.mydomain Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<apache@myUsername.mydomain> SIZE=29
250 2.1.0 <apache@myUsername.mydomain>... Sender ok
>>> RCPT To:<myUsername@hotmail.com>
>>> DATA
250 2.1.5 <myUsername@hotmail.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 i3JF8JkR002177 Message accepted for delivery
myUsername@hotmail.com... Sent (i3JF8JkR002177 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 myUsername.mydomain closing connection

-----------------
Using RedHat 9, linux 2.4.20-8

0
Comment
Question by:omom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 500 total points
ID: 10861490
Your box is transferring the message to Hotmail. Either Hotmail isn't willing to accept mail from your IP or it doesn't like the user name or message content. Hotmail has pretty extensive anti-spam provisions and if your system has an IP in one of the ranges used by non-commercial customers of an ISP (i.e., dialup, cable, or DSL accounts) it is likely to be black listed at Hotmail. The solution in a case like that is to configure Sendmail on your system to use your ISP's mail server asa smart host. This is easily done by including:

define(`SMART_HOST',`mail.my-isp.net')

in your sendmail.mc and building a new sendmail.cf.
0
 

Author Comment

by:omom
ID: 10862596
ok, that makes sense.
I made the change you specified, but I'm not able to rebuild sendmail.cf.  The instructions in sendmail.mc say:
If you make changes to /etc/mail/sendmail.mc, you will need to regenerate the /etc/mail/sendmail.cf file by confirming that the sendmail-cf package is installed and then performing a    make -C /etc/mail

# make -C /etc/mail
make: Entering directory `/etc/mail'
make: Leaving directory `/etc/mail'

# rpm -q sendmail
sendmail-8.12.8-5.90
# rpm -q sendmail-cf
package sendmail-cf is not installed

so i guess i don't have the sendmail-cf files.

At this point, do i look for sendmail-cf-8.12.8-5.90.rpm?
or do i 'upgrade' the sendmail pkg as well?
0
 

Author Comment

by:omom
ID: 10862695
i guess never mind on that question.
i just downloaded sendmail-cf-8.12.8-5.90.i386.rpm
i build it and get a new sendmail.cf, in which the SMART HOST statement appears, though i do get this error:

# make -C /etc/mail
make: Entering directory `/etc/mail'
mv: can't stat source sendmail.cf
make: Leaving directory `/etc/mail'
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

Author Comment

by:omom
ID: 10862721
also, i see that uuu.edu is apparently checking the domain of the email sender for validity:

Final-Recipient: RFC822; myUsername@uuu.edu
Action: failed
Status: 5.1.8
Diagnostic-Code: SMTP; 553 5.1.8 <apache@myComputerName.mydomain>... Domain of sender address apache@myComputerName.mydomain does not exist

myComputerName.mydomain is only know locally, of course.
i had to set this up (instead of using localhost) for apache.

0
 
LVL 40

Expert Comment

by:jlevie
ID: 10863522
The mail server at uuu.edu has been set up to refuse mail from hosts that don't have a valid domain name as a means of controlling spam. On a dial up account one can normally solve that by setting the host name to be what a reverse lookup of your dial up IP is or by giving the machine a hostname that lies within the domain of your ISP. If you can't use the hostname from a reverse lookup it should be safe to contruct a host name from the dial up IP. Assuming your dial up IP is 111.222.333.444 you could do something like:

111-222-333-444.my-isp.net
0
 

Author Comment

by:omom
ID: 10863739
Changing the hostname of the machine could cause a few problems with the system, a headache i'd rather not deal with.

I don't understand what you are saying about reverse lookup, ie I don't know what it is, or how i would implement it.  Can you explain?

also, the "mv: can't state source sendmail.cf" is not cause for concern?
0
 
LVL 40

Expert Comment

by:jlevie
ID: 10864339
> also, the "mv: can't state source sendmail.cf" is not cause for concern?

It would only be a concern if it is a persistant error. I suspect that a previous attempt at creating a new sendmail.cf when sendmail-cf wasn't installed may have been the cause of that error.

You won't be able to send mail to uuu.edu as long as the system's hostname isn't a name within a valid domain. As mentioned, a reasonable choice for a "dial up" machine is to set it's hostname to what a reverse lookup of your dialup IP returns. For example my firewall has as its Internet IP 216.78.168.29 and:

praetorian> host 216.78.168.29
29.168.78.216.in-addr.arpa domain name pointer adsl-78-168-29.hsv.bellsouth.net.

So I could configure the machine with the hostname of adsl-78-168-29.hsv.bellsouth.net
0
 

Author Comment

by:omom
ID: 10865124
I think I'm not going to worry about the ability to mail to *@uuu.edu because the site will ultimately be deployed on uuu.edu, so mailing to *@uuu.edu shouldn't be an issue.

I still don't have the ability to mail to *@hotmail.com because the sendmail doesn't like the line i put in.  On startup i get this:

Apr 19 19:11:07 myComputerName sendmail[850]: NOQUEUE: SYSERR(root): /etc/mail/sendmail.cf: line 39: unknown configuration line "define ('SMART_HOST', 'mail.zzz.com')"

I've tried a couple variations:
define (`SMART_HOST', `mail.zzz.com')
define ('SMART_HOST', 'mail.zzz.com')dnl

but it doesn't matter.

0
 
LVL 40

Expert Comment

by:jlevie
ID: 10865839
Below is what is in the /etc/mail/sendmail.mc on my laptop:

include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for Red Hat Linux')dnl
OSTYPE(`linux')dnl
dnl #
dnl # Uncomment and edit the following line if your outgoing mail needs to
dnl # be sent out through an external mail server:
dnl #
define(`SMART_HOST',`praetorian.entrophy-free.net')
dnl #

If you've been trying to include that in sendmail.cf it won't work. The directive has to be placed in /etc/mail/sendmail.mc and a new sendmail.cf built. That means that the sendmail-cf package must be installed on your system.
0
 

Author Comment

by:omom
ID: 10869266
No, i've been changing sendmail.mc and rebuilding, but good that you checked.

I fixed it, not sure what i did, which is scary 'cause if it happens again, I don't know how to fix it.  Can now send mail to *.hotmail.

Thanks, learned a lot here.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 10871638
There two things that come immediately to mind as possible problems with an mc file. One wuld be editing the file on a windows box and uploading the mc file to Linux. That will leave carriage returns in the file that m4 is likely to find confusing. The other is failing to use a match pair of ` (left) and ' (right) quotes around strings.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question