[rt-users] encoding of the email subject

Dimitry Faynerman dimitry.faynerman at hypermediasystems.com
Thu Jul 8 10:20:57 EDT 2004


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