mail(from)

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
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

mail(from)

Post by d3ad1ysp0rk »

Code: Select all

<?php
mail("lppunkskater@hotmail.com", "Automated Scipt", "$mailcontent");
?>
where would i put the $username variable to specify a sender?
User avatar
Kriek
Forum Contributor
Posts: 238
Joined: Wed May 29, 2002 3:46 am
Location: Florida
Contact:

Post by Kriek »

See -> the mail() function's additional_parameters.

Code: Select all

<?php
    $sendto = 'lppunkskater@hotmail.com';
    $subject = 'Automated Scipt';
    $header = "From: $name\r\nReply-To: $email\r\n";
    mail($sendto, $subject, $mailcontent, $header)
?>
Last edited by Kriek on Thu Oct 23, 2003 3:02 pm, edited 4 times in total.
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

"From" is actually a header that is included in the email. Heres an example. More at http://www.php.net/function.mail

Code: Select all

<?php
$to = "youremail@address.com";
$subject = "Hello There";
$message = "How are you doing?";
$headers = "From: sender@example.com\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Cc: example@example.com\r\n";
$headers .= "Bcc: example@example.com\r\n";
mail($to, $subject, $message, $headers);
?>
Post Reply