Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Mail with attachments, but w/o writing out a file first

by petdance (Parson)
on Sep 20, 2001 at 00:01 UTC ( [id://113463]=note: print w/replies, xml ) Need Help??


in reply to Mail with attachments, but w/o writing out a file first

Here's a chunk of code that is in production at my office:
my $subject = "FLR invoices"; my $msg = MIME::Entity->build( From => SOURCE, To => TARGET, Subject => $subject, Type => "multipart/mixed", ); my $textpart = <<END; Attached is the XML file $xmlfile. Andy END # Add the text greeting $msg->attach( Type => 'text/plain', Encoding => '7bit', Data => $textpart, ); # Add the XML file $msg->attach( Type => 'text/xml', Encoding => 'base64', Description => "XML file $xmlfile", Path => $xmlfile, ); $msg->send( 'sendmail' );
Note that the body is specified thru a variable, and the attachment is a file. I'm pretty sure you don't have to specify a filename when you create the attachment.

xoxo,
Andy
--
<megaphone> Throw down the gun and tiara and come out of the float! </megaphone>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://113463]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-25 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found