Email on behalf of user

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
satalways
Forum Newbie
Posts: 2
Joined: Thu Oct 11, 2007 11:30 pm

Email on behalf of user

Post by satalways »

Hi,
Can anybody tell me that how can I send email in PHP on behalf of any user...
User avatar
N1gel
Forum Commoner
Posts: 95
Joined: Sun Apr 30, 2006 12:01 pm

From

Post by N1gel »

Here is an example, you add the from into the header passed to the mail function.

Code: Select all

$to      = $email;
$subject = "new e-mail";
$message = "Hello I'm Your E-Mail";
$headers = "From: noreply@mywebsite.co.uk\r\n".'Cc: me@mywebsite.co.uk';

if( mail($to, $subject, $message, $headers) )
{
        echo "Mail Sent!!!";    
}
else
{
        echo "Unable to send mail";
}
satalways
Forum Newbie
Posts: 2
Joined: Thu Oct 11, 2007 11:30 pm

Post by satalways »

Dear friend,
please read again my question. You told me simple email sending method. I asked that how can we send email from behalf of any other person.
Post Reply