Hello,
I would like to embed image in RT template. Our goal is to create a scrip that’s sends an email to requestor when a ticket is created, and that email needs to contain a image.
I’ve tried embedding the image as base64 in img src tag. This generally works but doesn’t work in gmail so we can’t use it as many of our users use it.
I would not like to embed the image as link to remote location, because embedding images this way trigger anti-spam filters.
I’ve also tried to attach the image using email headers but it seems that RT changes the content-type header to text/plain.
Headers in template:
content-type: image/gif; name=“img.gif”
Content-Disposition: inline; filename=“img.gif”
Content-Id: img.gif
Content-Transfer-Encoding: base64
Received email:
content-type: text/plain; charset=“utf-8”; name=“img.gif”
Content-Disposition: inline; filename=“img.gif”
Content-Id: img.gif
Content-Transfer-Encoding: base64
X-RT-Original-Encoding: utf-8
It seems that this code in lib/RT/Action/SendEmail.pm is causing this:
# For security reasons, we only send out textual mails.
foreach my $part ( grep !$_->is_multipart, $MIMEObj->parts_DFS ) {
my $type = $part->mime_type || 'text/plain';
$type = 'text/plain' unless RT::I18N::IsTextualContentType($type);
$part->head->mime_attr( "Content-Type" => $type );
# utf-8 here is for _FindOrGuessCharset in I18N.pm
# it's not the final charset/encoding sent
$part->head->mime_attr( "Content-Type.charset" => 'utf-8' );
# Set proper transfer encoding to prevent long lines in
# body(1000+ chars) that are not allowed according to RFC821.
# Some mail servers automatically insert "!" into long lines to
# indicate this incompatibility.
if ( !$part->head->mime_attr('Content-Transfer-Encoding') ) {
$part->head->mime_attr( 'Content-Transfer-Encoding' => $part->suggest_encoding );
}
}
So if I am not mistaken a patch would be needed to support embedding images or may be there are other ways do solve this kind of problem?
Thank you,