Ask not what osTicket community can do for you - ask what you can do for osTicket community

Go Back   osTicket Forums > Project Tools > osTicket Bug Tracker > Bug

Issue Type Bug   Project osTicket Bug Tracker
Optional email's FROM name encoding
not working
Category Unknown
Affected Version 1.6 Stable
Priority Unknown
Status Unconfirmed
Fixed Version (none)
Submitted 05-16-2010
Assigned Users (none) Tags (none)

issueid=208 05-16-2010 03:22 PM
Junior Member
Optional email's FROM name encoding
not working

Hello all,

I have noticed that when i use croatian characters (like š č ć etc.) in "Optional email's FROM name" field on admin edit email settings page, e-mail could not be sent.

Regards,
Carlo
Reply

06-01-2010 12:17 PM
Junior Member
 
I just sent a ticket to my installation. The emails are from: "Fernando F Garcés" and within osticket I see the from as "Fernando F Garc" truncated

The same happens with the subject.

Original: "Envío de ..."
Result: "Env" truncated

Regards

Using V1.6

PD. All the tickets opened via email
Reply
12-30-2011 12:02 PM
Junior Member
 
Hi!

Same happens here with portuguese characters (like ç ã).

Error message:
Quote:
Unable to email via xxxxxxxxx:25 [xxxxx]

Validation failed for: =?ISO-8859-1?Q?"Administra=C3=A7=C3=A3o=20?==?ISO-8859-1?Q?de?= =?ISO-8859-1?Q?=20Sistemas"<xxxxx?==?ISO-8859-1?Q?@xxx.x?= =?ISO-8859-1?Q?xx.xxx.xx>?=
Regards
Reply
03-16-2012 02:30 AM
Junior Member
 
I think I found a way to handle with Optional email's FROM name encoding.
The problem is the From header is not encoded correctly, it should encode only the name part "xxx", not the address part <yyy@aaa.bbb.ccc>

There is my code updated in class.email.php:
In send method,
original:
Code:
        $fromname=$this->getName();
        $from =sprintf('"%s"<%s>',($fromname?$fromname:$this->getEmail()),$this->getEmail());
        $headers = array ('From' => $from
                          'To' => $to,
                          'Subject' => $subject,
                          'Date'=>date('D, d M Y H:i:s O'),
                          'Message-ID' =>'<'.Misc::randCode(6).''.time().'-'.$this->getEmail().'>',
                          'X-Mailer' =>'osTicket v 1.6',
                          'Content-Type' => 'text/html; charset="UTF-8"'
                          );
Changed to:
Code:
        $fromname=$this->getName();

// Patched by YHKao, don't add e-mail address here
        if (!$fromname) $fromname=$this->getEmail();
        $headers = array ('From' => $fromname,
                          'To' => $to,
                          'Subject' => $subject,
                          'Date'=>date('D, d M Y H:i:s O'),
                          'Message-ID' =>'<'.Misc::randCode(6).''.time().'-'.$this->getEmail().'>',
                          'X-Mailer' =>'osTicket v 1.6',
                          'Content-Type' => 'text/html; charset="UTF-8"'
                          );
And add the following code after getting encoded header
Code:
        //encode the headers.
        $headers = $mime->headers($headers);

// Patched by YHKao, add e-mail address in from after encoding
        $from =sprintf('"%s"<%s>',$headers['From'],$this->getEmail());
        $headers['From'] = $from;
The idea is to use original codes to do the From name encoding and append the address part just before sending out. And it works with Gmail smtp in my environment.
Reply

Issue Tools
Subscribe to this issue

All times are GMT -4. The time now is 10:46 AM.