using Mail::Sender to send email with attachment

Discussion in 'Perl Misc' started by eddiekwang@hotmail.com, Apr 18, 2006.

  1. Guest

    Hello,

    I am using perl on a Windows XP workstation. I need to use a perl
    script to send out an email with a html body and a pdf attachment.

    I was able to use the following code to send out an email with html
    body successfully, but I can't seem to add the attachment. when I tried
    the Attach method, both the html and pdf showed as attachment.

    Does anyone have an example on how to do this using Mail::Send?

    (I tried MIME::LITE and got an error - "'sendmail' is not recognized as
    an internal or external command ...". maybe Windows doesn't support
    MIME::LITE? )

    Any suggestions will be greatly appreciated.
    Eddy,

    *******************
    use Mail::Sender;

    $htmlfile = 'C:\temp\my_perl\weekOne.html'; # Name the file
    open IN, $htmlfile or die "Cannot open $htmlfile : $!\n";

    $sender = new Mail::Sender{smtp => 'smtp.ucsd.edu'};

    $sender->Open({ from => '', to => '',
    subject => 'HTML test',
    ctype => "text/html",
    encoding => "quoted-printable"
    }) or die $Mail::Sender::Error,"\n";

    while (read IN, $buff, 4096) { $sender->SendEnc($buff) };
    close IN;

    $sender->Close();
    ********************
     
    , Apr 18, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Showjumper
    Replies:
    2
    Views:
    1,856
    Showjumper
    Aug 2, 2003
  2. Dylan Parry
    Replies:
    2
    Views:
    589
  3. Shaldaman
    Replies:
    7
    Views:
    2,226
    Beauregard T. Shagnasty
    Jun 14, 2006
  4. Replies:
    0
    Views:
    422
  5. Replies:
    0
    Views:
    380
Loading...

Share This Page