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.
email not sending
Moderator: General Moderators
have you tried:
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.
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);
}In terms of log viewing, I think by default that php uses sendmail so if that logs failiures then you could try looking there.
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
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