For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > August 2007 > Sending HTML Email Using EMAIL::MIME::CreateHTML









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Sending HTML Email Using EMAIL::MIME::CreateHTML
Travis Hervey

2007-08-03, 7:02 pm

I am using the Email::MIME:CreateHTML module to send html formatted
emails. It all works fine until I try to change the "To" line to a
scalar so that I can mass mail to different individuals. Has anyone
used this module in a manner like this before? Thanks,

my $email = travis_hervey@georgetowncollege.edu;

while(<DAT> )

{

$line = TRIM($_);

$html = $html . $_;

if($line eq "</body>")

{

my $email = Email::MIME->create_html(

header => [

From => 'travis_hervey@georgetowncollege.edu',

To => '$email',

Subject => 'Some Subject',

],

body => $html,

);



my $sender = Email::Send->new({mailer => 'SMTP'});

$sender->mailer_args([Host => 'tiger.georgetowncollege.edu']);

$sender->send($email);

$html = "";

}

}

close(DAT);



Travis Hervey

Programmer Analyst

Georgetown College

400 East College Street

Georgetown KY, 40324

Tel: 1-502-863-8001

Fax: 1-502-686-8884

Email: travis_hervey@georgetowncollege.edu




Daniel Bosold

2007-08-03, 7:02 pm

On Fri Aug 3 13:22:11 2007, Travis Hervey wrote:
> I am using the Email::MIME:CreateHTML module to send html formatted
> emails. It all works fine until I try to change the "To" line to a
> scalar so that I can mass mail to different individuals. Has anyone
> used this module in a manner like this before? Thanks,
>
> my $email = travis_hervey@georgetowncollege.edu;
>
> while(<DAT> )
>
> {
>
> $line = TRIM($_);
>
> $html = $html . $_;
>
> if($line eq "</body>")
>
> {
>
> my $email = Email::MIME->create_html(
>
> header => [
>
> From => 'travis_hervey@georgetowncollege.edu',
>
> To => '$email',
>
> Subject => 'Some Subject',
>
> ],
>
> body => $html,
>
> );
>
>
>
> my $sender = Email::Send->new({mailer => 'SMTP'});
>
> $sender->mailer_args([Host => 'tiger.georgetowncollege.edu']);
>
> $sender->send($email);
>
> $html = "";
>
> }
>
> }
>
> close(DAT);
>
>


get rid of the single quotes around $email. a variable inside single quotesis just text. a variable inside double quotes will do what you expect.

d.

--
==========================
$mysig = <<EOS;
while(1){
....
}

daniël <daniel@0x64.nl>, <devogon@gmail.com>
http://0x64.nl
gmail talk: devogon

EOS

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com