Solved

PHPMailer-FE charset - accented characters missing in mailbox

Posted on 2010-11-12
3
911 Views
Last Modified: 2012-05-10
Hi - would very much appreciate some suggestions re:

using PHPMailer-FE on a site - http://www.colorpoli.it/contatti.php

PHPMailer-FE is really good, however I've hit a snag... when messages sent via the mailform arrive in the destination mailbox(es), not only are the accented characters, such è,ò,à, missing but the string in which they are contained are also completely missing - the form entry just not there! When I then send another message with regular characters... no problem. So, the mailform's working ok, but not handling the accented characters.

 mailbox screenshot
I've changed the meta tag on the php page in which the mailform appears, and also found the appropriate parts of code in phpmailer-fe.php...4th line from last in this code snippet...

function mail_it($content, $subject, $email, $realname, $recipient, $inbound=true) {
  global $attachment_chunk, $attachment_name, $attachment_type, $attachment_temp;
  global $local_chunk, $local_name, $local_type, $local_temp;
  global $bcc, $cc;
  global $PHPMailerLocation, $PHPMailerLiteLocation;
  global $fixedFromEmail, $fixedFromName, $text_only, $htmlCharset;

  if ($realname) {
    $sendTo = $realname . "<" . $email . ">";
  } else {
    $sendTo = $email;
  }
  $ob = "----=_OuterBoundary_000";
  $ib = "----=_InnerBoundery_001";

  $mail_headers  = "MIME-Version: 1.0\r\n";
  if ($fixedFromEmail != '') {
    $mail_headers .= "From: " . $fixedFromEmail . "\n";
  } else {
    $mail_headers .= "From: " . $sendTo . "\n";
  }
  $mail_headers .= "To: " . $recipient . "\n";
  $mail_headers .= "Reply-To: " . $sendTo . "\n";
  if ($cc)  { $mail_headers .= "Cc: ".$cc."\n"; }
  if ($bcc) { $mail_headers .= "Bcc: ".$bcc."\n"; }
  $mail_headers .= "X-Priority: 1\n";
  $mail_headers .= "X-Mailer: PHPMailer-FE v" . VERSION . " (software by codeworxtech.com)\n";
  $mail_headers .= "Content-Type: multipart/mixed;\n\tboundary=\"" . $ob . "\"\n";
  $mail_message  = "This is a multi-part message in MIME format.\n";
  $mail_message .= "\n--".$ob."\n";
  $mail_message .= "Content-Type: multipart/alternative;\n\tboundary=\"" . $ib . "\"\n\n";
  $mail_message .= "\n--" . $ib . "\n";
  $mail_message .= "Content-Type: text/plain;\n\tcharset=\"" . $htmlCharset . "\"\n";
  $mail_message .= "Content-Transfer-Encoding: quoted-printable\n\n";
  $mail_message .= $content["text"] . "\n\n";
  $mail_message .= "\n--" . $ib . "--\n";

Open in new window


$htmlCharset is previously defined in phpmailer-fe.php in this line...

/**
 * Used as the charset for HTML emails
 * default is "iso-8859-1"
 * @var string
 * NOTE: Required here, change as needed
 */
$htmlCharset    = "iso-8859-1";

Open in new window


So, as can be seen, the default charset should be fine for the accented characters in question. I have, however, tried changing it to other charset specs but to no avail.

The problem appears in mailboxes on:

my local mailclient (thunderbird 3.1.6 on W7),
namesco webmail, (http://webmail.names.co.uk)
aruba webmail, (http:/www.webmail.aruba.it)...and...
libero.it webmail

2 of these are italian based for chrissake! Ok Scott...breathe...

I've also submitted a support ticket with namesco (who are generally brilliant!..and where the site is hosted) to ask if there could be anything happening their end, but I'll need to wait til tmrw for a response...

So, there it is - any ideas? Thanks in advance...

Scott

 mailbox screenshot
0
Comment
Question by:scottieclark
  • 2
3 Comments
 
LVL 1

Expert Comment

by:elliottwebsites
ID: 34125385
Try adding in before the message is sent:
<?php
$str = "A 'quote' is <b>bold</b>";

// Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt;
echo htmlentities($str);
?>

Open in new window


Taken from: http://php.net/manual/en/function.htmlentities.php
0
 

Accepted Solution

by:
scottieclark earned 0 total points
ID: 34206390
after taking the time to post a question with as much detail as possible, inc. screenshots etc. I'm pretty disappointed with ONE response of 1 line and 6 lines of code, especially when the complexity of the code I'm trying to work with makes it obvious that no-one has even bothered to look closely at the question. I'm paying for what?...
0
 

Author Closing Comment

by:scottieclark
ID: 34228636
disappointed. could be my fault if i've posted without following some esoteric protocol but for a second post since signing up i can't imagine it was so bad!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Import PST to Exchange using Power Shell new-mailboximportrequest command, you can simply import the PST file into Exchange mailbox or archived. To know How to import PST into Exchange  2013 read the complete article.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now