email not sending

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
omom
Forum Newbie
Posts: 13
Joined: Sun Apr 04, 2004 9:58 pm

email not sending

Post by omom »

I have this function:

function sendEmail()
{
$to = 'jack@uuu.edu';
$subject = 'Hello';
$body = 'Greetings!';
mail($to, $subject, $body);

$to = 'jack@zzz.com';
mail($to, $subject, $body);

$to = 'jill@uuu.edu';
mail($to, $subject, $body);
}

When called, the email gets sent to jack@zzz.com but never to the other two (both @uuu.edu).
If i send an email to either @uuu.edu the normal way (i.e. non-programmatcally), they are sent and received normally.

First, i guess i need to verify that the emails are being sent. How do I do this? is there a log file to view?

Assuming that they are, what is the next step?

Using RedHat 9.0 with KDE, Apache 2.0.48.
phait
Forum Commoner
Posts: 46
Joined: Wed Apr 07, 2004 4:41 am
Location: watford / leicester, UK

Post by phait »

have you tried:

Code: Select all

function sendEmail() 
{ 
$to = 'jack@uuu.edu' . ','; 
$to .= 'jack@zzz.com' . ','; 
$to .= 'jill@uuu.edu'; 

$subject = 'Hello'; 
$body = 'Greetings!'; 

mail($to, $subject, $body); 
}
concatenate the $to var and separate each addresses with a comma.

In terms of log viewing, I think by default that php uses sendmail so if that logs failiures then you could try looking there.
omom
Forum Newbie
Posts: 13
Joined: Sun Apr 04, 2004 9:58 pm

Post by omom »

I tried concatenating the to strings as your suggested, but the behavior is the same.

What is the name/location of the sendmail log file?
omom
Forum Newbie
Posts: 13
Joined: Sun Apr 04, 2004 9:58 pm

Post by omom »

this must be it:
/var/maillog

according to that, the messages are going out.
omom
Forum Newbie
Posts: 13
Joined: Sun Apr 04, 2004 9:58 pm

Post by omom »

sorry, /var/log/maillog
omom
Forum Newbie
Posts: 13
Joined: Sun Apr 04, 2004 9:58 pm

Post by omom »

There is an error indicated when sending to anyuser@uuu.edu, but not to anyuser@zzz.com

log when sending to myUserName@zzz.com (no error):

Apr 15 18:53:58 myUserName sendmail[1684]: i3G0rrhM001682: to=<myUserName@zzz.com>, ctladdr=<websrv@myUserName.mydomain> (503/503), delay=00:00:05, xdelay=00:00:05, mailer=esmtp, pri=30316, relay=smtp0.zzz.com. [216.234.192.171], dsn=2.0.0, stat=Sent (ok 1082076807 qp 54442)
Apr 15 18:54:16 myUserName sendmail[1691]: i3G0sFFf001691: from=websrv, size=112, class=0, nrcpts=1, msgid=<200404160054.i3G0sFFf001691@myUserName.mydomain>, relay=websrv@localhost
Apr 15 18:54:16 myUserName sendmail[1693]: i3G0sGhM001693: from=<websrv@myUserName.mydomain>, size=375, class=0, nrcpts=1, msgid=<200404160054.i3G0sFFf001691@myUserName.mydomain>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Apr 15 18:54:16 myUserName sendmail[1691]: i3G0sFFf001691: to=myUserName@zzz.com, ctladdr=websrv (503/503), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30053, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (i3G0sGhM001693 Message accepted for delivery)
Apr 15 18:54:18 myUserName sendmail[1695]: i3G0sGhM001693: to=<myUserName@zzz.com>, ctladdr=<websrv@myUserName.mydomain> (503/503), delay=00:00:02, xdelay=00:00:02, mailer=esmtp, pri=30316, relay=smtp0.zzz.com. [216.234.192.171], dsn=2.0.0, stat=Sent (ok 1082076827 qp 68805)

log when sending to anyuser@uuu.edu (Data format error):

Apr 15 18:56:57 myUserName sendmail[1730]: i3G0uvXI001730: from=websrv, size=109, class=0, nrcpts=1, msgid=<200404160056.i3G0uvXI001730@myUserName.mydomain>, relay=websrv@localhost
Apr 15 18:56:58 myUserName sendmail[1732]: i3G0uvhM001732: from=<websrv@myUserName.mydomain>, size=372, class=0, nrcpts=1, msgid=<200404160056.i3G0uvXI001730@myUserName.mydomain>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Apr 15 18:56:58 myUserName sendmail[1730]: i3G0uvXI001730: to=anyuser@uuu.edu, ctladdr=websrv (503/503), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30048, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (i3G0uvhM001732 Message accepted for delivery)
Apr 15 18:56:59 myUserName sendmail[1734]: i3G0uvhM001732: to=<anyuser@uuu.edu>, ctladdr=<websrv@myUserName.mydomain> (503/503), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=30311, relay=dns1.uuu.edu. [128.123.3.5], dsn=5.6.0, stat=Data format error
Apr 15 18:56:59 myUserName sendmail[1734]: i3G0uvhM001732: forward /usr/local/apache/.forward.myUserName: Group writable directory
Apr 15 18:56:59 myUserName sendmail[1734]: i3G0uvhM001732: forward /usr/local/apache/.forward: Group writable directory
Apr 15 18:56:59 myUserName sendmail[1734]: i3G0uvhM001732: i3G0uxhM001734: DSN: Data format error
Apr 15 18:57:00 myUserName sendmail[1734]: i3G0uxhM001734: to=<websrv@myUserName.mydomain>, delay=00:00:01, xdelay=00:00:01, mailer=local, pri=31396, dsn=2.0.0, stat=Sent
Post Reply