Email::Send


A

Andy

I'm using the perl module Email::Send to generate email. In my tests,
the send function executes and no errors are thrown. But, even though
I'm sending the email to myself through my local SMTP email server to
my local exchange server, nothing seems to happen.

I'm also using Email::MIME and Email::MIME::Creator to build the email
headers.

Does anyone have any suggestions on what is going wrong or how to
diagnose the problem?

Here's the code I'm calling to send the email:

#SendEmail($html,$text,$sender,$recipient,$subject,$smtpserver);
sub SendEmail{
($html,$text,$sender,$recipient,$subject,$smtpserver)[email protected]_;

@multipart = (
Email::MIME->create(
attributes => {
content_type => "text/plain",
format => "flowed",
charset => "US-ASCII",
},
body => $text,
),
Email::MIME->create(
attributes => {
content_type => "text/html",
charset => "US-ASCII",
encoding => "quoted-printable",
format => "flowed",
},
body => $html,
),
);


$email = Email::MIME->create(
header => [ From => $sender ],
parts => [ @multipart ],
);


$email->header_set( To => $recipient );
$email->header_set( Subject => $subject );

$email->header_set( 'Content-Type' => 'multipart/alternative' );
$email->boundary_set('INFOTEK_Boundary_text');

$mailer = Email::Send->new({mailer => 'SMTP'});
$mailer->mailer_args([Host => "$smtpserver"]);
$mailer->send($email);
}
 
Ad

Advertisements

A

Andy

Sorry about that, here's a more legible copy of the code:


#SendEmail($html,$text,$sender,$recipient,$subject,$smtpserver);
sub SendEmail{
($html,$text,$sender,$recipient,$subject,$smtpserver)[email protected]_;

@multipart = (
Email::MIME->create(
attributes => {
content_type => "text/plain",
format => "flowed",
charset => "US-ASCII",
},
body => $text,
),
Email::MIME->create(
attributes => {
content_type => "text/html",
charset => "US-ASCII",
encoding => "quoted-printable",
format => "flowed",
},
body => $html,
),
);

$email = Email::MIME->create(
header => [ From => $sender ],
parts => [ @multipart ],
);

$email->header_set( To => $recipient );
$email->header_set( Subject => $subject );
$email->header_set( 'Content-Type' => 'multipart/alternative' );
$email->boundary_set('INFOTEK_Boundary_text');

$mailer = Email::Send->new({mailer => 'SMTP'});
$mailer->mailer_args([Host => "$smtpserver"]);
$mailer->send($email);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top