Hi,
I am trying to prepare the headrs for an email to be sent by the mail function. I want the 'from' field to be determined by user input and therefore a variable. So I am trying this with:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: ' .$email. "\r\n";
However this does not work, the email does not send.
Any ideas what I am doing wrong?
Thanks in advance....
Rob.
PHP Headers
Moderator: General Moderators
Re: PHP Headers
Code: Select all
function mailer($f, $t, $s, $b) { // from to subject body
$headers = null;
$headers .= "Return-Path: $f\r\n";
if (preg_match("#<.*?>#s", $b)) {
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
}
$headers .= "From: $f\r\n";
$headers .= "Reply-To: $f\r\n";
mail($t, $s, $b, $headers);
}
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
Re: PHP Headers
Thanks that worked. I already had it working actually, the meials were going to my bulk flder though!
Regards,
Rob.
Regards,
Rob.
Re: PHP Headers
robburne would you mind disclosing your source, I was trying to get the same thing working,
but for whatever reason I'm getting a error. Would be nice to have something to check against.
Thanks mate
but for whatever reason I'm getting a error. Would be nice to have something to check against.
Thanks mate
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
Re: PHP Headers
Code: Select all
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: $email\r\n";
$headers .= "Reply-To: $email\r\n";
mail($mailto, $mailsubject, $mailbody, $headers);Rob.