• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space
  • Chevereto Support CLST

    Support response

    Support checklist

    • Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • Confirm that the server meets the System Requirements
    • Check for any available Hotfix - your issue could be already reported/fixed
    • Read documentation - It will be required to Debug and understand Errors for a faster support response

Messed encoding for feedback emails

Status
Not open for further replies.

gobzer

Chevereto Member
First, the bug:
All feedback emails, containing non-latin chars become garbled like that -
арнольд

Debug process:
I went to /app/themes/Peafowl/pages/contact.php to see what is happening.
We're getting utf-8 input from a form (because feedback page and whole site is utf-8) and sending it to a mailer class.
/app/lib/classes/class.mailer.php tells us that the mailer is an extension for phpmailer, which is located at
/app/vendor/phpmailer/class.phpmailer.php
Looking through Send and preSend functions I noticed CharSet parameter which is explained as "The character set of the message" and defaults to 'iso-8859-1'.
contact.php does not set this parameter, so phpmailer processes utf-8 message with a wrong 'iso-8859-1' charset.
I've searched for a phpmailer encoding problems and found this document:
http://stackoverflow.com/questions/2491475/phpmailer-character-encoding-issues
Where people send their messages with
$mail->CharSet='UTF-8';

Solution:
Edit
/app/themes/Peafowl/pages/contact.php
Add
$mail->CharSet='UTF-8';
after
$mail->Timeout = 30;

This solution is general, not specific.

Improvement:
I also think that it would be cool if this feedback form would automaticaly fill the name and email inputs if user is logged in.
 
Now about improvement:
/app/themes/Peafowl/pages/contact.php
To fill email for logged in user line 102:
HTML:
                <input type="text" name="name" id="name" class="text-input" placeholder="<?php _se('Your name'); ?>" value="<?php if($is_error) { echo get_safe_post()['name']; }else{ echo CHV\Login::isLoggedUser() ? CHV\Login::getUser()['name'] : ''; } ?>" required="">
To fill name for logged in user line 107:
HTML:
                <input type="email" name="email" id="email" class="text-input" placeholder="<?php _se('Your email address'); ?>" value="<?php if($is_error) { echo get_safe_post()['email']; }else{ echo CHV\Login::isLoggedUser() ? CHV\Login::getUser()['email'] : ''; } ?>" required="">
 
Improvement:
I also think that it would be cool if this feedback form would automaticaly fill the name and email inputs if user is logged in.

If the user is logged in you will get the username and a link for this profile info in the email. By the way, I'm updating the pages so I will use the CHV\send_mail() function for this.

Cheers.
 
Last edited:
Status
Not open for further replies.
Back
Top