Avatar of scottieclark
scottieclarkFlag for Italy

asked on 

PHPMailer-FE charset - accented characters missing in mailbox

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.

 User generated image
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

 User generated image
PHPEmail ProtocolsEmail Servers

Avatar of undefined
Last Comment
scottieclark
Avatar of elliottwebsites
elliottwebsites

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
ASKER CERTIFIED SOLUTION
Avatar of scottieclark
scottieclark
Flag of Italy image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of scottieclark
scottieclark
Flag of Italy image

ASKER

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!
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo