MIME::Lite HTML Message Handling

Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default MIME::Lite HTML Message Handling

    I am working on the code below:
    ************************************************** ****
    use strict;
    use MIME::Lite;
    use Net::SMTP;
    my $from = 'steve@earthlink.net';
    my @addweek1 = qw(michael@earthlink.net
    [email]jennifer@aol.com[/email]
    );
    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 Guest

  2. Similar Questions and Discussions

    1. [MIME::Lite] not recognizing carriage-returns in body of message
      I am using MIME::Lite to send an e-mail with a file attachment. Everything works well except for the body of the message. I am using Type => 'TEXT'...
    2. how to display html in email message body with mime:: entity
      Hi, Is it possible to display html in email message body with mime:: entity. I'd like to display an html table in the email body I send out with...
    3. MIME::Lite Message Body
      I run the code below, and something strange happens: use strict; use MIME::Lite; use Net::SMTP; my $from = 'steve@earthlink.net'; my @addweek1...
    4. MIME::Lite - HTML Message and pdf Attaching at the same time
      I run the code below, and it works perfectly fine: ================================================== use strict; use MIME::Lite; use Net::SMTP;...
    5. MIME::Lite html-attachment broken
      Christian Grauer <cgrauer@netscript.de> wrote: Where's the data content (e.g. test1.htm) so we can reproduce your problem? Chris --...
  3. #2

    Default Re: MIME::Lite HTML Message Handling

    "John B. Kim" <askjinu@earthlink.net> wrote in message
    news:plxOb.15141$1e.9466@newsread2.news.pas.earthl ink.net...
    > I am working on the code below:
    ....
    > use MIME::Lite;
    ....
    > $msg->attach (
    > Type => 'text/html',
    > Data => qq{$message});
    >...
    > 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.
    I wonder, did you actually try to read the documentation for MIME::Lite ?
    perldoc MIME::Lite

    you do not want Data, you want Path

    gnari




    gnari Guest

  4. #3

    Default Re: MIME::Lite HTML Message Handling

    "gnari" <gnari@simnet.is> wrote in message
    news:bueas1$o3e$1@news.simnet.is...
    > "John B. Kim" <askjinu@earthlink.net> wrote in message
    > news:plxOb.15141$1e.9466@newsread2.news.pas.earthl ink.net...
    > > I am working on the code below:
    [snipped code]
    >
    > you do not want Data, you want Path
    as you correctly use in the next attachment, in fact

    gnari



    gnari Guest

  5. #4

    Default Re: MIME::Lite HTML Message Handling


    "John B. Kim" <askjinu@earthlink.net> wrote:
    > I am working on the code below:
    > ************************************************** ****
    > use strict;
    Good... you also want

    use warnings;
    > use MIME::Lite;
    > use Net::SMTP;
    > my $from = 'steve@earthlink.net';
    > my @addweek1 = qw(michael@earthlink.net
    > [email]jennifer@aol.com[/email]
    > );
    > 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});
    Instead of using Data, use Path:

    Path => 'c:/message1.html');

    Even on Win32, you should use / rather than \ for pathnames.
    >
    > $msg->attach (
    > Type => 'x-pdf',
    PDF has a MIME type: application/pdf. Use it.
    > Path => "c:\\guide\\JNIssue11\\$Fnameweek1",
    > Filename => $Fnameweek1);
    > MIME::Lite->send('smtp', 'smtp.earthlink.net');
    > $msg->send();
    > }
    Ben

    --
    We do not stop playing because we grow old;
    we grow old because we stop playing.
    [email]ben@morrow.me.uk[/email]
    Ben Morrow Guest

  6. #5

    Default Re: MIME::Lite HTML Message Handling

    I run the code below, and something strange happens:

    use strict;
    use MIME::Lite;
    use Net::SMTP;
    my $from = 'steve@earthlink.net';
    my @addweek1 = qw(michael@earthlink.net
    );

    my $subject='Issue 11';

    for my $address (@addweek1) {
    my $msg = MIME::Lite->new (
    From => $from,
    To => $address,

    Subject => $subject,
    Type =>'multipart/related');

    $msg->attach (
    Type => 'text/html',
    Path => 'c:/message.html');


    MIME::Lite->send('smtp', 'smtp.earthlink.net');
    $msg->send();
    }

    I run the code above, and I opened my Outlook. 1 email came in. And the
    email has the sign of attachment: the clip on the left, which means there is
    an attachment with an email.

    And at the bottom pane, I see the body of email, which I wish to be there.
    But if I double click that email, the body is completely blank, and the
    attachment sign, clip disappears.

    What is left out of is an email without anything in the body.

    Strange..

    "Ben Morrow" <usenet@morrow.me.uk> wrote in message
    news:bueeri$g9i$2@wisteria.csv.warwick.ac.uk...
    >
    > "John B. Kim" <askjinu@earthlink.net> wrote:
    > > I am working on the code below:
    > > ************************************************** ****
    > > use strict;
    >
    > Good... you also want
    >
    > use warnings;
    >
    > > use MIME::Lite;
    > > use Net::SMTP;
    > > my $from = 'steve@earthlink.net';
    > > my @addweek1 = qw(michael@earthlink.net
    > > [email]jennifer@aol.com[/email]
    > > );
    > > 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});
    >
    > Instead of using Data, use Path:
    >
    > Path => 'c:/message1.html');
    >

    snoopy Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139