Ask a Question related to PERL Modules, Design and Development.
-
John B. Kim #1
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
-
[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'... -
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... -
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... -
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;... -
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 --... -
gnari #2
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;I> $msg->attach (
> Type => 'text/html',
> Data => qq{$message});
>...
> What I would like to realize is through my $message = 'C:\\message1.html',in> wish qq{$message reads the contents of c:\message1.html.
>
> However, when I run the above codes, rather than seeing the html messagea> 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 ascontent> beginer, I cannot figure what to put after Data => qq{ so that theI wonder, did you actually try to read the documentation for MIME::Lite ?> of c:\message.html be place as email body.
perldoc MIME::Lite
you do not want Data, you want Path
gnari
gnari Guest
-
gnari #3
Re: MIME::Lite HTML Message Handling
"gnari" <gnari@simnet.is> wrote in message
news:bueas1$o3e$1@news.simnet.is...[snipped code]> "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:as you correctly use in the next attachment, in fact>
> you do not want Data, you want Path
gnari
gnari Guest
-
Ben Morrow #4
Re: MIME::Lite HTML Message Handling
"John B. Kim" <askjinu@earthlink.net> wrote:Good... you also want> I am working on the code below:
> ************************************************** ****
> use strict;
use warnings;
Instead of using Data, use Path:> 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});
Path => 'c:/message1.html');
Even on Win32, you should use / rather than \ for pathnames.
PDF has a MIME type: application/pdf. Use it.>
> $msg->attach (
> Type => 'x-pdf',
Ben> Path => "c:\\guide\\JNIssue11\\$Fnameweek1",
> Filename => $Fnameweek1);
> MIME::Lite->send('smtp', 'smtp.earthlink.net');
> $msg->send();
> }
--
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
-
snoopy #5
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



Reply With Quote

