/    Sign up×
Community /Pin to ProfileBookmark

mailer.php, not sending html emails

ok i have this php script;

[code=php]
<?PHP
$to = “[email protected]”;
$subject = “Feedback – Alabu Soap”;
$headers = “From: Alabu Soap Feedback”;

$date = date (“l, F jS, Y”);
$time = date (“h:i A”);

$msg = “Below is the result of Alabu’s Feedback form, it was submitted on $date at $time.nn”;

if ($_SERVER[‘REQUEST_METHOD’] == “POST”) {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) .” : “. $value . “n”;
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) .” : “. $value . “n”;
}
}

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header (“Location:$location”);
}
else {
}

$to = “$email”;
$subject = “Re: Feedback – Alabu Soap”;
$headers = “From: Alabu_Soap”;
$forward = 1;
$location = “http://65.215.194.171/forms/feedbackreply.html”;

$date = date (“l, F jS, Y”);
$time = date (“h:i A”);

$msg = “<html><body><font face=Arial, Helvetica, sans-serif>Thank you for your note, we recieved it on $date at $time, below is a copy of your message.</font><br><br><hr align=left width=50%></body></html>nn”;

if ($_SERVER[‘REQUEST_METHOD’] == “POST”) {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) .” : “. $value . “n”;
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) .” : “. $value . “n”;
}
}

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header (“Location:$location”);
}
else {
}
?>
[/code]

everything works fine except for the html part, if i send it to like a hotmail accnt or something like that, it shows up as an html email, but if i send it to say, my email address, which i check using microsoft outlook, it comes as a plain text email and has all the ugly html tags in the mesage. any ideas how to fix that? to just make sure it sends as an html email every time? thanks…

Hal

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@pyroMar 16.2004 — Add this below your existing $headers line:

[code=php]$headers .= "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=iso-8859-1rn";[/code]
Copy linkTweet thisAlerts:
@lahmayesauthorMar 16.2004 — thanks pyro!!! i do have one other question,

is there anyway to make the from say exactly what you want? for example, right now the from address

says "Alabu_SoapMIME-Version:[email protected]" is there any way to at least get rid of

the mime version in there, or even better make it say "[email protected]" i know how

to forge email addys through telnet but i'm not sure how legal that is? well, thanks again!
Copy linkTweet thisAlerts:
@pyroMar 16.2004 — Add this to your $headers... ?

[code=php]$headers = "From: Your Name <[email protected]>rn";[/code]
Copy linkTweet thisAlerts:
@lahmayesauthorMar 16.2004 — hey what can i say, your the man! ? thanks bro.
Copy linkTweet thisAlerts:
@pyroMar 16.2004 — hehe... Happy to help. ?
×

Success!

Help @lahmayes spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...