On Thu, Aug 09, 2007 at 04:02:41AM +0200, Firas Kraiem wrote:
> Greetings,
>
> I'm using the sendmail binary found in the mini_sendmail-chroot package to 
> be able to use the mail() function in PHP pages. However, it simply refuses 
> to send mail when I specify the recipient address in the form "Name 
> <[EMAIL PROTECTED]>".
>
> For the example, let's consider the following PHP script :
>
>       <?php
>       $endl="\n";
>
>       $headers =
>               "MIME-Version: 1.0$endl".
>               "Content-type: text/plain; charset=utf-8$endl".
>               "Content-Transfer-Encoding: 8bit$endl".
>               "X-Mailer: Foo$endl".
>               "From: Foo Bar <[EMAIL PROTECTED]>$endl".
>               "Reply-To: Foo Baz <[EMAIL PROTECTED]>";
>
>       $dest = "Myself <[EMAIL PROTECTED]>";
>       $subject = "foo";
>       $body = "foo$endl"."bar";
>
>       mail( $dest, $subject, $body, $headers );
>       ?>
>
> When run from the shell, thus in a non-chrooted environment and using the 
> system's sendmail, the script works as expected. However, when run in 
> Apache, no mail is sent and the following line appears in the error log :
>
>       /usr/sbin/sendmail: unexpected response 553 to RCPT TO command
>
> And if I just put "[EMAIL PROTECTED]" in my $dest variable, the mail is sent 
> in both environments, so this is clearly the "mini sendmail" not liking 
> recipient addresses in the "Name <address>" format.
>
> So I wonder, is it a bug, a configuration mistake, or is it simply how it's 
> supposed to work ? Any input would be appreciated.

Just use the basic address in the mail() call. (Or switch to femail, as
pointed out.)

I note that the PHP specification of the mail() call seems to indicate
that what you are doing should work. But PHP just calls the 'sendmail'
configured in php.ini, so that's conditional on that program (c.q.
mini_sendmail) understanding such things.

You could wrap mail() if so inclined.

                Joachim

-- 
TFMotD: afslog (1) - obtain AFS tokens

Reply via email to