[ic] Email tag / MIME:Lite
Phil Smith
phil.smith at phil-home.com
Thu Oct 8 10:59:03 UTC 2020
>I think you're right about that. So it doesn't look like any of the
>[email] calls in the Strap demo use MIME::Lite.
>
>Jon
It looks like MIME::Lite is no longer working within Interchange, would anyone please share their replacement UserTags, before I hack my own together.
I have a simple [perl] block working, usinf Mail::Sendmail, which will probably do the job, I will flwesh it out to a UserTag with some sanity checks. But would be nice to see anyone else’s UserTags that may be more elegant/stable.
[perl global=1]
use MIME::QuotedPrint;
use MIME::Base64;
use Mail::Sendmail;
my %mail = ( from => 'phil at example.com', to => 'phil at hotmail.com', subject => 'Test from IC'
);
my $boundary = "====" . time() . "====";
$mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\"";
my $message = encode_qp( "<h1>This is a test email.</h1>");
my $file = "/var/www/html/IC/test.pdf";
open (F, $file) or die "Cannot read $file: $!";
binmode F; undef $/;
$mail{body} = encode_base64(<F>);
close F;
my $boundary = '--'.$boundary;
$mail{body} = <<END_OF_BODY;
$boundary
Content-Type: text/HTML; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
$message
$boundary
Content-Type: application/octet-stream; name="$^X"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Complaints.pdf"
$mail{body}
$boundary--
END_OF_BODY
sendmail(%mail) || print "Error: $Mail::Sendmail::error\n";
[/perl]
--
This email has been checked for viruses by AVG.
https://www.avg.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.interchangecommerce.org/pipermail/interchange-users/attachments/20201008/3c9c6f21/attachment.htm>
More information about the interchange-users
mailing list