[ic] Extension for Vend::Interpolate::mime ?

Lars Tode lars.tode at bpanet.de
Thu Oct 13 06:09:40 EDT 2005

Hi list and developers.

Following situation:
There is a formular which should be send per mail to the shop owner.
The user should be able to add an attachment (word, pdf ... whatever) to
this email.

After the user had submit the form, the file should be encoded to base64
and attached to the email.

That's all.

To attach the credit card information to the report should be something
similar, so i use [tag mime] and [email_raw] to create the email.

Two things happend. If the content isn't base64 encoded, the attachment
is broken. If the content is 64 encoded the download attachment is still
the base64 content.

I checked the whole mail content and following.
Normally if you send an email with base64 encoded attachment, following
header should be added to the boundary-mime-header:

Content-Transfer-Encoding: Base64

The Vend::Interpolate::mime doesn't use this header.
Because I have no idea if there was a more simple way to send emails
with base64 encoded attachment, I modified the code in that function:

	elsif($option eq 'header') {
		$id = _mime_id();
		$out = <<EndOFmiMe;
MIME-Version: 1.0
Content-Type: $msg_type; BOUNDARY="$::Instance->{MIME_BOUNDARY}"
Content-ID: $id
	elsif ( $text !~ /\S/) {
		$out = '';
	else {
		$id = _mime_id();
		$::Instance->{MIME} = 1;
		my $desc = $opt->{description} || $option;
		my $type = $opt->{type} || 'TEXT/PLAIN;
		my $transferencoding		=
($opt->{'transferencoding'}) ? "Content-Transfer-Encoding:
".$opt->{'transferencoding'}."\n" : '';
		my $disposition = $opt->{attach_only} ? qq{attachment;
filename="$desc"} : "inline";
		$out = <<EndOFmiMe;
Content-Type: $type
Content-ID: $id
Content-Disposition: $disposition
Content-Description: $desc


I added 
> my $transferencoding		= ($opt->{'transferencoding'}) ?
"Content-Transfer-Encoding: ".$opt->{'transferencoding'}."\n" : '';

And insert the variable in the mime header

> Content-Description: $desc
> $transferencoding
> $text

If there is use of this modification? 

If someone really knows a better solution, please send me an email.



More information about the interchange-users mailing list