Re: php sendmail_from

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Actually, you can send an email from explicit email addres without
modifying htaccess or php ini.
In simple words, PHP uses MTA (like postfix or sendmail) to send email to
another email address. An email consist of header, body, and mime (for
example an attachment). Sender, receiver, Subject, and other parts of
message are laid in header. Body is used to store the message.

We can use PHP to write the header of message so we can change sender email
address. For example:

<?php
$to      = 'nobody@xxxxxxxxxxx';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@xxxxxxxxxxx' . "\r\n" .
    'Reply-To: webmaster@xxxxxxxxxxx' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

You can see the example above from PHP manual.

On Tue, Jan 10, 2012 at 1:53 AM, alexus <alexus@xxxxxxxxx> wrote:

> I need to change sendmail from field, I added following to my .htaccess:
>
> php_value sendmail_from 'XXX@xxxxxxx'
>
> and tried to send out an email, but it still comes from apache@FQDN
>
> through phpinfo(); I see as local value my email address XXX@xxxxxxx
>
> --
> http://alexus.org/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Duken Marga
http://duken.info

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux