desertrat has asked for the wisdom of the Perl Monks concerning the following question:
On the recieving end the message is empty with an attachment icon with the filename (zero bytes long), and in the message source the body of the message looks like:#!/usr/bin/perl use strict; use MIME::Base64; use MIME::QUotedPrint; use Mail::Sendmail; my $s=<<eos; foo, bar, baz, name, email, important note TRUE,FALSE,TRUE, JoeUser, joeuser1\@there.com, This is the bosses kid eos my $req=encode_qp("I need to make a request for this important person! +"); my $cn = "Joe User"; my $estr=encode_base64($s); print $req."\n"; print $estr; my %msg =(from => 'valid email address',to=>'valid email address',subj +ect =>'test of attachment'); my $boundary= "==========".time()."=========="; $msg{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; $msg{'body'}=<<eob; --$boundary Content-Type: text/plain Content-Transfer-Encoding: quoted-printable $req --$boundary Content-Type: text/csv Content-Tranfer-Encoding: base64 Content-Disposition: attachment; filename="account request for $cn.csv +" $estr --$boundary-- eob sendmail(%msg) or die "Sending failed Error: $Mail::Sendmail::error"; exit;
Looking at everything I've found for this, it should work...what am I missing. (note if I just do this:MIME-Version: 1.0 --==========1596563290========== Content-Type: text/plain Content-Transfer-Encoding: quoted-printable --==========1596563290========== Content-Type: text/csv Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="account request for Joe Use +r.csv" --==========1596563290==========--
It works as expected...#sending a plain text message, maybe sendmail is messed up?? my %msg2 =(from => 'avalidemailaddress',to=>'avalidemailaddress',subje +ct =>'plain email', body=>"just a quick note!"); sendmail(%msg2) or die "Sending failed Error: $Mail::Sendmail::error";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems using Mail::Sendmail to include an attachment
by hippo (Archbishop) on Aug 04, 2020 at 20:41 UTC | |
by desertrat (Sexton) on Aug 05, 2020 at 00:53 UTC | |
|
Re: Problems using Mail::Sendmail to include an attachment
by haukex (Archbishop) on Aug 05, 2020 at 20:11 UTC |