MIME::Lite HTML message handling

Discussion in 'Perl' started by John B. Kim, Jan 18, 2004.

  1. John B. Kim

    John B. Kim Guest

    I am working on the code below:
    ******************************************************
    use strict;
    use MIME::Lite;
    use Net::SMTP;
    my $from = '';
    my @addweek1 = qw(

    );
    my $Fnameweek1 = 'JNIssue11.pdf';
    my $subject='Issue 11';
    my $message = 'C:\\message1.html';
    for my $address (@addweek1) {
    my $msg = MIME::Lite->new (
    From => $from,
    To => $address,
    Subject => $subject,
    Type =>'multipart/related');

    $msg->attach (
    Type => 'text/html',
    Data => qq{$message});

    $msg->attach (
    Type => 'x-pdf',
    Path => "c:\\guide\\JNIssue11\\$Fnameweek1",
    Filename => $Fnameweek1);
    MIME::Lite->send('smtp', 'smtp.earthlink.net');
    $msg->send();
    }
    ***************************************
    The above codes attach the pdf file I have in my hard drive and send the
    email to multiple recepients with pdf attachments. Now I use this codes to
    send messages with different attachments and different HTML messages to the
    same group of recipients. With the codes above I can just change the name
    and location of new attachment with different version of emailing, but for
    now I have to always copy and paste lengthy html message after qq{..

    What I would like to realize is through my $message = 'C:\\message1.html', I
    wish qq{$message reads the contents of c:\message1.html.

    However, when I run the above codes, rather than seeing the html message in
    the email body, I just see c:\message.html in the body of the email sent.

    It probably is something simple for an experienced Perl programmer, but as a
    beginer, I cannot figure what to put after Data => qq{ so that the content
    of c:\message.html be place as email body.

    Any help will be deeply appreciated. I hope my message is clear enough so
    that people understand what I am struggling about.
    John B. Kim, Jan 18, 2004
    #1
    1. Advertising

  2. John B. Kim

    Joe Smith Guest

    John B. Kim wrote:

    > my $message = 'C:\\message1.html';
    > ...
    > $msg->attach (
    > Type => 'text/html',
    > Data => qq{$message});


    Have you tried changing that to
    Path => $message,
    Filename => $message;


    -Joe
    --
    I love my TiVo - http://www.inwap.com/u/joe/tivo/
    Joe Smith, Jan 19, 2004
    #2
    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. Zev Steinhardt

    Perl Mime::Lite question. Help please?

    Zev Steinhardt, Aug 24, 2004, in forum: Perl
    Replies:
    1
    Views:
    742
    dan baker
    Sep 1, 2004
  2. Aaron Brady

    SQL, lite lite lite

    Aaron Brady, Dec 29, 2008, in forum: Python
    Replies:
    15
    Views:
    734
    Aaron Brady
    Jan 1, 2009
  3. Jane Humbrey
    Replies:
    5
    Views:
    263
    Jane Humbrey
    Sep 1, 2003
  4. Replies:
    8
    Views:
    171
    AlamuKutty
    Dec 10, 2004
  5. Ted Byers
    Replies:
    0
    Views:
    264
    Ted Byers
    Jun 24, 2010
Loading...

Share This Page