New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
utf-8 special charatecters problem with some email clients sending mail with inline images (base64 encoded) #279
Comments
You've not posted your code so I can't tell what you're doing. The default charset is ISO-8859-1, so you need to set |
I already use it $mail->CharSet = 'utf-8' after $mail = new PHPMailer(); $datura = strftime("%A %d %B %Y");
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->setFrom('xxxx@xxx.com', 'Newsletter');
$mail->addAddress(yyyyy@yyyy.com, 'yyyy');
$mail->Subject = utf8_encode('Le principali tendenze del packaging ... '.$datura);
$body = file_get_contents('contents.html');
$mail->msgHTML($body, dirname(__FILE__));
$mail->AltBody = 'Le ultime notizie sul mondo del beverage';
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo . ' ' . $mailsingola . '<br />';
} else {
echo "Message sent! " . $mailsingola;
} It works correctly with all email clients. It does not work only when I insert one or more inline images in the contents.html file, and only with Windows Mail and Outlook as i tested. The html file contains |
meta http-equiv="Content-Type" content="text/html; charset=utf-8" |
Why are you calling Is UTF-8 working anywhere in the message, for example in the subject line? Can you post complete messages (perhaps in a gist rather than here) with and without the images so we can compare them? |
Please can you check out the master branch which has some changes relating to this and give it a try - I've tried various things but I can't make it go wrong as you describe. See also #377 |
Closing due to no feedback. |
Hi, I've read a lovely book recently, the author is admired by everyone, you should read the book too, that's for sure, here is the link http://quoshuzyque.5fingerlickin.com/e4dtcpil Very truly yours, ljlorente |
$mail->CharSet = "UTF-8"; |
Hi Synchro, <?php
session_start();
include("php/abcdefghikjl/PHPMailerAutoload.php");
$to = 'commune@domain.fr';
if(isset($_POST['emailSent'])) {
$subject = utf8_decode($_POST[‘subject’]);
if (strtolower($_POST["captcha"]) == strtolower($_SESSION['captcha']['code'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$message = utf8_decode($message);
// Step 3 - Configure the fields list that you want to receive on the email.
$fields = array(
0 => array(
'text' => 'Nom',
'val' => $_POST['name']
),
1 => array(
'text' => 'Adresse Email',
'val' => $_POST['email']
),
2 => array(
'text' => 'Message',
'val' => $_POST['message']
),
3 => array(
'text' => 'Objet de ce Message',
'val' => $_POST['select']
),
4 => array(
'text' => '-Raisons de votre Demande',
'val' => implode($_POST['checkboxes'], ", ")
),
5 => array(
'text' => '-Qui souhaitez-vous Rencontrer',
'val' => $_POST['radios']
)
);
$message = "";
foreach($fields as $field) {
$message .= $field['text'].": " . htmlspecialchars($field['val'], ENT_QUOTES) . "<br>\n";
}
$mail = new PHPMailer;
$mail->isHTML(true);
$mail->CharSet = 'utf-8';
//$mail->IsSMTP(); // Set mailer to use SMTP
//$mail->SMTPDebug = 0; // Debug Mode
$mail->Host = 'mail.domain.fr'; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'noreply@domain.fr'; // SMTP username
$mail->Password = 'secretpassword'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
$mail->Port = 587; // TCP port to connect to
$mail->From = $email;
$mail->FromName = $_POST['name'];
$mail->AddAddress($to);
$mail->AddReplyTo($email, $name);
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $message;
if($mail->Send()) {
$arrResult = array('response'=> 'success');
} else {
$arrResult = array('response'=> 'error', 'error'=> $mail->ErrorInfo);
}
} else {
$arrResult['response'] = 'captchaError';
}
}
?> And my message input is:
Please, can help do solving this accent troubles as users are complaining to the City Hall and I do not know what to answer |
Bonjour David, The problem is that you are doing this:
I also note in that |
Bonjour Synchro, |
Hi again @Synchro I am really sorry to inform you that the message body is empty ;-)
|
You need to be absolutely sure where the text is going astray, so test using fixed strings instead of your form, for example:
A separate problem is this:
That is forgery and will result in your messages being spam-filtered or bounced. Put your own address in there and use the submitter's address as a reply-to address (which you're already doing). |
OK @Synchro I'll do what you answered me and I'll tell you ;-) @Synchro |
Hi @Synchro |
Oui, il fait une belle journée 🏔☀️ - pas comme mon français! Je suis heureux vous avez résolu le problème! |
Hi,
First of all I would like to thank you for your great work.
I have a problem with some email clients when sending email in html utf-8 that contain special characters and i insert one or more inline images (base64 encoded).
It works good with Thunderbird, Gmail, Opera Mail but in Windows Mail and MS Outlook for example the text: "èé@àààùè" became "èé@à à à ùè". If I don't add inline images work well with all the client i tested.
The text was updated successfully, but these errors were encountered: