keithneargarder--

I don't have one for Mail::SendEasy, but I have one I did a while ago using Mime::Lite and Net::SMTP. Here it is, if it'll help...

#!/usr/bin/perl #------------------------------------------------------------------- # faxer.pl <recipient> <file> # # Send file <file> to <recipient>. Note that the recipient field is # a specially formatted field that contains recipient name, fax #, # and email address of the fax server, like so: # # "/name=Lonnie Phillips/fax=5551234/<rfax@npc.net>" # # 20050111 Roboticus - Added comments, some error checking # ???????? LPhillips - originally written #------------------------------------------------------------------- use strict; use MIME::Lite; MIME::Lite->send('smtp','mail.your.domain',Timeout=>60); use Net::SMTP; my $smtp = Net::SMTP->new('mail.your.domain', Debug=>1); print $smtp->domain,"\n"; my $usage= 'usage: faxer.pl <recipient> where: <recipient> = Fax address, formatted like: "/name=Roboticus/fax=5551234/<rfax@your.domain>" '; #my $fax_dest = @ARGV[0] or die $usage . "\nmissing <recipient>"; my $msg = MIME::Lite->new( To => '/name=%fromName%/fax=%toFax%/<rfax@your.domain>', From => 'MailBot@your.domain', Subject => 'Roboticus\'s test fax', Type => 'multipart/related', ) or die "Error creating MIME container!\n"; $msg->attach( Type => 'text/html', Data => qq {<html> <body> <img src="cid:ltrhead.gif"> </p> <div align="center"> <table border="1"> <tr align="center"><td colspan="2">TO</td><td colspan="2">FROM</td></ +tr> <tr><td align="right">Name:</td><td>%toName%</td><td align="right">Na +me:</td><t d>%fromName%</tr> <tr><td align="right">Fax:</td><td>%toFax%</td><td align="right">Fax: +</td><td>% fromFax%</td></tr> <tr><td></td><td></td><td align="right">Phone:</td><td>%fromPhone%</t +d></tr> <tr><td></td><td></td><td align="right">EMail:</td><td>%fromEMail%</t +d></tr> </table> </div> <hr> </p> To Whom It May Concern,</p> Regional Security is currently conducting a review on merchant %MerchID% "%MerchName%" for a batch of \$%MerchBatch%.</p> All funds are on hold until the review is complete. If you have any questions or information, please feel free to contact me at %fromPhone +% or email me at %fromEMail%.</p> Thank You,</p> %fromName% </body> </html> }, ) or die "Error creating HTML!\n"; $msg->attach( Type => 'image/gif', Id => 'ltrhead.gif', Path => 'fake_letterhead.gif', ) or die "Error adding image!\n"; open(OUTF,">faxer.mht") or die "Can't open output file"; print OUTF $msg->as_string; close(OUTF); $smtp->mail('mmason@npc.net'); ##$smtp->to('/name=Roboticus/fax=5551234/<rfax@your.domain>'); $smtp->to('roboticus@your.domain'); $smtp->data(); $smtp->datasend($msg->as_string); $smtp->dataend(); $smtp->quit();

Note: I've hacked out a little proprietary stuff, and this is just an experimental (proof of concept) program I wrote some time ago. It functions, but will need some tweaking!

--roboticus


In reply to Re: Need a Mail::SendEasy example using attachments by roboticus
in thread Need a Mail::SendEasy example using attachments by keithneargarder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.