Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

PHPMailer-FE charset - accented characters missing in mailbox

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

Title # Comments Views Activity
Get a subdirectory name from a url 5 27
mysql query for sum() 3 28
PHP Mail error 3 26
How do I show metrics with PHP or Javascript 6 32
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The new Gmail Phishing Scam going around is surprising even the savviest of users with its sophisticated techniques.
In this video we show how to create an Address List 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 Organization >> Ad…
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…

839 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