MIME::Lite HTML message handling

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John B. Kim

    MIME::Lite HTML message handling

    I am working on the code below:
    *************** *************** *************** *********
    use strict;
    use MIME::Lite;
    use Net::SMTP;
    my $from = 'steve@earthlin k.net';
    my @addweek1 = qw(michael@eart hlink.net
    jennifer@aol.co m
    );
    my $Fnameweek1 = 'JNIssue11.pdf' ;
    my $subject='Issue 11';
    my $message = 'C:\\message1.h tml';
    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\\JNI ssue11\\$Fnamew eek1",
    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.h tml', I
    wish qq{$message reads the contents of c:\message1.htm l.

    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.




  • Joe Smith

    #2
    Re: MIME::Lite HTML message handling

    John B. Kim wrote:
    [color=blue]
    > my $message = 'C:\\message1.h tml';
    > ...
    > $msg->attach (
    > Type => 'text/html',
    > Data => qq{$message});[/color]

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


    -Joe
    --
    I love my TiVo - http://www.inwap.com/u/joe/tivo/

    Comment

    Working...