Jump to content

Recommended Posts

I think it's setup correct, I have

 

$to = ''.$email.'';
$subject = "Code";
$headers = "From: DES <[email protected]>\r\n";
$headers .= "Reply-To: [email protected]\r\n";
$headers .= "Return-Path: [email protected]\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/plain; charset=ISO-8859-1\r\n";

$message = '£10';
mail($to,$subject,$message,$headers);

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/143484-php-mail-problem/#findComment-752722
Share on other sites

  • 3 years later...

Just thought I would add some info to this as it was not previously resolved.

 

The issue is indeed the charset.

 

When creating plain text emails from PHP I also include the following:

 

$mimeandcharset = "MIME-Version: 1.0\r\n";

$mimeandcharset .= "Content-Type: text/plain; charset=utf-8\r\n";

 

$headers = "From: $from\r\n";

$headers .= $mimeandcharset;

 

I split this out as often I use the some of the same contents to email myself as well as the user, so in this way you can do the following and the ? sign will display as it should without the annoying ? thing before it:

 

// create the mime and charset variable

$mimeandcharset .= "MIME-Version: 1.0\r\n";

$mimeandcharset .= "Content-Type: text/plain; charset=utf-8\r\n"; // notice I have used utf-8 but you can use what ever you need to, but this will of course affect the use of symbols

 

//create the headers for the email to the site owner

$headers = "From: $useremailaddress\r\n";

$headers .= $mimeandcharset;

 

// Send the message to site owner

$owneremail = "[email protected]"

$subject = "The subject line"

$mailtext = "Some text"

 

mail($owneremail, $subject, $mailtext, $headers);

 

// send an email to the website user

$custheaders = "From:$owneremail\r\n";

$custheaders .= $mimeandcharset;

$body = "A whole bunch of customer service type words that could include the $mailtext too";

 

mail ($useremailaddress, "Re: $subject", $body, $custheaders);

 

 

 

Hope this helps

 

Link to comment
https://forums.phpfreaks.com/topic/143484-php-mail-problem/#findComment-1377180
Share on other sites

Apologies, I am new to this. Here is the amended post:

 

Just thought I would add some info to this as it was not previously resolved.

 

The issue is indeed the charset.

 

When creating plain text emails from PHP I also include the following:

 

$mimeandcharset = "MIME-Version: 1.0\r\n";
$mimeandcharset .= "Content-Type: text/plain; charset=utf-8\r\n";

$headers = "From: $from\r\n";
$headers .= $mimeandcharset;

 

I split this out as often I use the some of the same contents to email myself as well as the user, so in this way you can do the following and the pound sign will display as it should without the annoying symbol thing before it:

 

// create the mime and charset variable
$mimeandcharset .= "MIME-Version: 1.0\r\n";
$mimeandcharset .= "Content-Type: text/plain; charset=utf-8\r\n"; // notice I have used utf-8 but you can use what ever you need to, but this will of course affect the use of symbols

//create the headers for the email to the site owner
$headers = "From: $useremailaddress\r\n";
$headers .= $mimeandcharset;

// Send the message to site owner
$owneremail = "[email protected]"
$subject = "The subject line"
$mailtext = "Some text"

mail($owneremail, $subject, $mailtext, $headers);

// send an email to the website user
$custheaders = "From:$owneremail\r\n";
$custheaders .= $mimeandcharset;
$body = "A whole bunch of customer service type words that could include the $mailtext too";

mail ($useremailaddress, "Re: $subject", $body, $custheaders);

 

 

Hope this helps

Link to comment
https://forums.phpfreaks.com/topic/143484-php-mail-problem/#findComment-1377183
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.