Jon McCauley
2005-Jun-14 16:11 UTC
[CentOS] CentOS / BQ / PHP 4.3.9 with the mail() function
Hey everyone! Got a little problem...with CentOS / BQ / PHP 4.3.9 with the mail() function I'm able to send mail using postfix directly from the command line, however when I try using the mail function of php no mail is being sent. This simple script works on all my older Cobalt Boxs. <? if($action=="send") { $to = 'me at domain.dot'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: me at domain.dot' . "\r\n" . 'Reply-To: me at domain.dot' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> the queue looks like this.... Jun 14 11:47:45 bq0 sendmail[19390]: j5EFljEU019390: from=<>, size=1146, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1] Jun 14 11:47:45 bq0 sendmail[19389]: j5EFljk1019389: j5EFljk2019389: return to sender: User unknown Jun 14 11:47:45 bq0 sendmail[19390]: j5EFljEW019390: from=<>, size=3858, class=0, nrcpts=1, msgid=<200506141547.j5EFljk2019389 at bq.ontarioservers.com>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1] Jun 14 11:47:45 bq0 sendmail[19389]: j5EFljk2019389: to=postmaster, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=32170, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (j5EFljEW019390 Message accepted for delivery) Jun 14 11:47:45 bq0 sendmail[19391]: j5EFljEW019390: to=admin, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=34070, dsn=2.0.0, stat=Sent I did a some googling and found a post http://forums.fedoraforum.org/showthread.php?t=27608 Any sujestons as what I should do .....I dont want to play with another script to get this done??....thanks in advance -- Best Regards, Jon McCauley
Robin Mordasiewicz
2005-Jun-14 16:24 UTC
[CentOS] CentOS / BQ / PHP 4.3.9 with the mail() function
On Tue, 14 Jun 2005, Jon McCauley wrote:> > I'm able to send mail using postfix directly from the command line, however > when I try using the mail function of php no mail is being sent. This simple > script works on all my older Cobalt Boxs. > > <? if($action=="send") { > $to = 'me at domain.dot'; > $subject = 'the subject'; > $message = 'hello'; > $headers = 'From: me at domain.dot' . "\r\n" . > 'Reply-To: me at domain.dot' . "\r\n" . > 'X-Mailer: PHP/' . phpversion(); > > mail($to, $subject, $message, $headers); > ?> > > the queue looks like this.... > Jun 14 11:47:45 bq0 sendmail[19390]: j5EFljEU019390: from=<>, size=1146, > class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1] > Jun 14 11:47:45 bq0 sendmail[19389]: j5EFljk1019389: j5EFljk2019389: return > to sender: User unknown > Jun 14 11:47:45 bq0 sendmail[19390]: j5EFljEW019390: from=<>, size=3858, > class=0, nrcpts=1, msgid=<200506141547.j5EFljk2019389 at bq.ontarioservers.com>, > proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1] > Jun 14 11:47:45 bq0 sendmail[19389]: j5EFljk2019389: to=postmaster, > delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=32170, relay=[127.0.0.1] > [127.0.0.1], dsn=2.0.0, stat=Sent (j5EFljEW019390 Message accepted for > delivery) > Jun 14 11:47:45 bq0 sendmail[19391]: j5EFljEW019390: to=admin, > delay=00:00:00, xdelay=00:00:00, mailer=local, pri=34070, dsn=2.0.0, > stat=Sent >hmm, to me it looks like you did successfully send mail. it looks like the mail was sent to postmaster. mebbe check your aliases file to see who gets postmaster email.
Maciej Żenczykowski
2005-Jun-14 17:26 UTC
[CentOS] CentOS / BQ / PHP 4.3.9 with the mail() function
try the following - using php pear and an smtp connection to localhost instead of trying to exec postfix and running amok of selinux. $recipients = "maze at tcs.ii.uj.edu.pl"; $headers["From"] = "PHP at TCS <php at tcs.ii.uj.edu.pl>"; $headers["To"] = "Maciej ?enczykowski <maze at tcs.ii.uj.edu.pl>"; $headers["Subject"] = "PHP Test message subject."; $body = "This is the test message text."; //$params["host"] = "localhost"; //$params["port"] = "25"; //$params["auth"] = false; //$params["username"] = "user"; //$params["password"] = "password"; include("Mail.php"); // this is coming from /usr/share/pear // so make sure php is allowed to include files from // there if it's in safe mode // /etc/php.ini: // safe_mode_include_dir = /usr/share/pear/ // include_path = ".:/php/includes:/usr/share/pear" $mail_object =& Mail::factory("smtp", $params); $mail_object->send($recipients, $headers, $body);
Alexander Dalloz
2005-Jun-14 17:52 UTC
[CentOS] CentOS / BQ / PHP 4.3.9 with the mail() function
Am Di, den 14.06.2005 schrieb Jon McCauley um 18:11:> Got a little problem...with CentOS / BQ / PHP 4.3.9 with the mail() > function > > I'm able to send mail using postfix directly from the command line,Not Postfix, the log below clearly shows Sendmail activity.> however when I try using the mail function of php no mail is being sent. > This simple script works on all my older Cobalt Boxs. > > <? if($action=="send") { > $to = 'me at domain.dot'; > $subject = 'the subject'; > $message = 'hello'; > $headers = 'From: me at domain.dot' . "\r\n" . > 'Reply-To: me at domain.dot' . "\r\n" . > 'X-Mailer: PHP/' . phpversion(); > > mail($to, $subject, $message, $headers); > ?> > > the queue looks like this....The first log entry is missing, queue ID j5EFljEU019390.> Jun 14 11:47:45 bq0 sendmail[19390]: j5EFljEU019390: from=<>, size=1146, > class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1] > Jun 14 11:47:45 bq0 sendmail[19389]: j5EFljk1019389: j5EFljk2019389: > return to sender: User unknownThe reason; more to be seen in the non delivery notification ...> Jun 14 11:47:45 bq0 sendmail[19390]: j5EFljEW019390: from=<>, size=3858, > class=0, nrcpts=1, > msgid=<200506141547.j5EFljk2019389 at bq.ontarioservers.com>, proto=ESMTP, > daemon=MTA, relay=localhost [127.0.0.1] > Jun 14 11:47:45 bq0 sendmail[19389]: j5EFljk2019389: to=postmaster,... sent to the postmaster.> delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=32170, > relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (j5EFljEW019390 > Message accepted for delivery) > Jun 14 11:47:45 bq0 sendmail[19391]: j5EFljEW019390: to=admin, > delay=00:00:00, xdelay=00:00:00, mailer=local, pri=34070, dsn=2.0.0, > stat=Sent > > > I did a some googling and found a post > http://forums.fedoraforum.org/showthread.php?t=27608 > > Any sujestons as what I should do .....I dont want to play with another > script to get this done??....thanks in advanceBetter do as Maciej showed you and use Pear. It preserves you from several headaches using the mail() function directly. Also get clear which MTA you are really wanting to run; actually Sendmail seems to not be configured properly. And finally, using Apache to speak to the MTA directly will not work when SELinux is enabled. Alexander -- Alexander Dalloz | Enger, Germany | GPG http://pgp.mit.edu 0xB366A773 legal statement: http://www.uni-x.org/legal.html Fedora Core 2 GNU/Linux on Athlon with kernel 2.6.11-1.27_FC2smp Serendipity 19:46:04 up 21 days, 18:23, load average: 0.15, 0.16, 0.11 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Dies ist ein digital signierter Nachrichtenteil URL: <http://lists.centos.org/pipermail/centos/attachments/20050614/1deb5898/attachment-0003.sig>
Jon McCauley
2005-Jun-14 18:41 UTC
[CentOS] CentOS / BQ / PHP 4.3.9 with the mail() function
>Better do as Maciej showed you and use Pear. It preserves you from >several headaches using the mail() function directly. Also get clear >which MTA you are really wanting to run; actually Sendmail seems to not >be configured properly. And finally, using Apache to speak to the MTA >directly will not work when SELinux is enabled. > >Alexander > >Thanks for the posts guys ;) I found out Sendmail >8.12 has been re-modeled to tighten msp-queue rules. Thus, internal processes send mails will go to msp-queue 1st. in /etc/mail/virtusrtable I removed @your-box-fqdn error:nouser No such user here and every thing works now with out changing the mail() function Best Regards, Jon McCauley