Emails display as plain text in .icloud clients
            2 posts by 2 authors in: Forums > CMS Builder
Last Post: April 15, 2014   (RSS)          
By mktresults - April 14, 2014
Hi Guys,
We are sending emails to users with the emailTemplate_load function and it is throwing this error (This is a multi-part message in MIME format.------_mixed_2d3886c11d6c4a5999535 then the rest in plain text) for .icloud, .mac, & .me addresses
the email is only using $PLACEHOLDERS tag to pull in the content
Here is the code that is sending the email:
// send email to user
                $emailTemplate = "email/email_reset_password2.php";
                $emailHeaders  = emailTemplate_load(array(
                      'template'     => websiteLogin_pluginDir() . "/$emailTemplate",
                      'subject'      => '', // set in template
                      'from'         => '', // set in template
                      'to'           => $user['email'],
                      'placeholders' => array(
                      'firstname'      => mb_convert_case($user['firstname'], MB_CASE_TITLE, "UTF-8"),
                      'lastname'       => mb_convert_case($user['lastname'], MB_CASE_TITLE, "UTF-8"),
                      'resetUrl'       => $resetQuery,
                      ),
                    ));
                $mailErrors   = sendMessage($emailHeaders);
                if ($mailErrors) { die("Mail Error: $mailErrors"); 
                }
Thanks!
By gregThomas - April 15, 2014
Hi,
The issue might be that the firstname and lastname fields are accidentally being double encoded, as you're explicitly calling them to be encoded in UTF-8.
Have you tried using the ucword function instead?
// send email to user
$emailTemplate = "email/email_reset_password2.php";
$emailHeaders  = emailTemplate_load(array(
  'template'     => websiteLogin_pluginDir() . "/$emailTemplate",
  'subject'      => '', // set in template
  'from'         => '', // set in template
  'to'           => $user['email'],
  'placeholders' => array(
  'firstname'      => ucwords(strtolower($user['firstname'])),
  'lastname'       => ucwords(strtolower($user['lastname'])),
  'resetUrl'       => $resetQuery,
  ),
));
$mailErrors   = sendMessage($emailHeaders);
if ($mailErrors) { die("Mail Error: $mailErrors"); 
}
You could also try calling the mb_convert_case function without specifying the encoding:
// send email to user
$emailTemplate = "email/email_reset_password2.php";
$emailHeaders  = emailTemplate_load(array(
      'template'     => websiteLogin_pluginDir() . "/$emailTemplate",
      'subject'      => '', // set in template
      'from'         => '', // set in template
      'to'           => $user['email'],
      'placeholders' => array(
      'firstname'      => mb_convert_case($user['firstname'], MB_CASE_TITLE),
      'lastname'       => mb_convert_case($user['lastname'], MB_CASE_TITLE),
      'resetUrl'       => $resetQuery,
      ),
    ));
$mailErrors   = sendMessage($emailHeaders);
if ($mailErrors) { die("Mail Error: $mailErrors"); 
}
Let me know if this doesn't work.
Thanks!
Greg
PHP Programmer - interactivetools.com