[rt-users] RE: encoding of the email subject

Dimitry Faynerman dimitry.faynerman at hypermediasystems.com
Fri Jul 9 12:00:13 EDT 2004


Nobody can help me with that???



-----Original Message-----
From: Dimitry Faynerman [mailto:dimitry.faynerman at hypermediasystems.com] 
Sent: Thursday, July 08, 2004 7:21 AM
To: 'rt-users at lists.bestpractical.com'
Subject: encoding of the email subject

Hello,

I wrote a script for sending an email for password retrieval. Since the user
is not logged in RT when this email is being sent, I have to do some stuff
manually (which normally RT is doing for me). So I use something like this:

===============================================================
my $template = RT::Template->new( $self->CurrentUser );
$template->LoadGlobalTemplate('Password Change');

my $parsed = $template->_ParseContent();

my $entity = MIME::Entity->build(
                               From => $from,
                               To => $email,
                               'X-RT-Loop-Prevention' => $RT::rtname,
                               Type => "text/plain",
                               Charset => "utf-8",
                               Subject => loc("Trouble Ticket New
Password"),
                               Data => [$parsed]
                               );

RT::I18N::SetMIMEEntityToEncoding( $entity, $RT::EmailOutputEncoding,
'mime_words_ok' );
open (MAIL, "|$RT::SendmailPath $RT::SendmailArguments") || return(0);
print MAIL $entity->as_string;
close(MAIL);
===============================================================


The problem is that even tough the email body has the correct encoding
(shift-jis in my case), the email subject is still broken. I tried many
tricks but had no luck. 
Could anybody tell me what I'm doing wrong?

Thanks!

Dimitry





More information about the rt-users mailing list