Re: PHP's mail(): proper way to send a 'From' header

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

 



> <?php
> 
> $to = "email1@xxxxxxxxxxx";
> 
> $from = "email2@xxxxxxxxxxx";
> 
> $subject = "This is a test!";
> 
> $body  = "\tThis is a test email.\n";
> $body .= "That is all.";
> 
> $headers  = "From: ".$from."\r\n";
> $headers .= "Reply-To: ".$from."\r\n";
> $headers .= "X-Mailer: ".basename(__FILE__)."-PHP/".phpversion()."\r\n";
> $headers .= "Return-Path: ".$from."\r\n";
> 
> mail($to,$subject,$body,$headers,'-f'.$from);
> ?>
> 
>     Note the fifth parameter passed to mail():
> 
>         http://php.net/mail
> 

And also note that the 5th parameter is an email address only.. Don't do
something like:

<?php

$from = "Me <email@xxxxxxxxxxx>";

and try to use that as the 5th parameter, it won't work.

-- 
Postgresql & php tutorials
http://www.designmagick.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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