Solved

PHPMailer-FE charset - accented characters missing in mailbox

Posted on 2010-11-12
3
912 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
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

896 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

19 Experts available now in Live!

Get 1:1 Help Now