|
List Info
Thread: Trying to Send mail
|
|
| Trying to Send mail |

|
2007-01-30 14:56:48 |
|
I am trying to get mail working but I have yet been able to
get tit to work properly, I am using MIME::Lite
Not sure what I am doing wrong
use MIME::Lite;
# set up email
$to = "beagle alinean.com,
beneagle earthlink.net";
$from = "me example.com";
$subject = "Email Sent via Perl";
$message = "This email was sent using Perl.";
$file = "graph1.jpg";
# send email
email($to, $from, $subject, $message, $file);
# email function
sub email
{
# get incoming parameters
local ($to, $from, $subject, $message, $file) = _;
# create a new message
$msg = MIME::Lite->new(
From => $from,
To => $to,
Subject => $subject,
Data => $message
);
# add the attachment
$msg->attach(
Type => "image/jpeg",
Path => $file,
Filename => $file,
Disposition => "attachment"
);
# send the email
MIME::Lite->send('smtp', 'email01.alinean.com', Timeout
=> 60);
$msg->send();
}
it gives me a error on $msg->send();
not sure why
|
| Re: Trying to Send mail |

|
2007-01-30 15:36:23 |
Ben Eagle wrote:
> I am trying to get mail working but I have yet been
able to get tit to
> work properly, I am using MIME::Lite
Worked for me with my own to, from, file and email server.
Try running
this one as is and if it still fails, set debug to 1 and
check for diag msgs.
Make sure you have the right smtp mail host.
use strict;
use warnings;
use MIME::Lite;
my $debug = 0; # set to 1 to get diags
my $to = 'beagle alinean.com, beneagle earthlink.net';
my $from = 'me example.com';
my $subject = "Email Sent via Perl";
my $message = "This email was sent using Perl.";
my $file = "graph1.jpg";
email ($to, $from, $subject, $message, $file);
exit;
sub email {
my ($to, $from, $subject, $message, $file) = _;
MIME::Lite->send('smtp', 'email01.alinean.com', Timeout
=> 60, Debug => $debug);
my $msg = MIME::Lite->new(From => $from, To => $to,
Subject => $subject,
Data => $message) or die "new MIME::Lite: $!
($^E)";
$msg->attach(Type => 'image/jpeg', Path => $file,
Filename => $file,
Disposition => 'attachment') or die "attach
$file: $! ($^E)";
$msg->send or die "send: $! ($^E)";
}
__END__
_______________________________________________
Perl-Win32-Web mailing list
Perl-Win32-Web listserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs
|
|
| RE: Trying to Send mail |

|
2007-01-31 12:17:29 |
|
What’;s the error? That would be the
biggest help in getting you an answer.
From: perl-win32-web-bounces listserv.ActiveState.com
[mailto:perl-win32-web-bounces listserv.ActiveState.com] On Behalf Of Ben Eagle
Sent: Tuesday, January 30, 2007
1:57 PM
To:
perl-win32-web listserv.ActiveState.com
Subject: Trying to Send mail
I am trying to get mail working but I have yet been able to
get tit to work properly, I am using MIME::Lite
Not sure what I am doing wrong
use MIME::Lite;
# set up email
$to = "beagle alinean.com,
beneagle earthlink.net";
$from = "me example.com";
$subject = "Email Sent via Perl";
$message = "This email was sent using Perl.";
$file = "graph1.jpg";
# send email
email($to, $from, $subject, $message, $file);
# email function
sub email
{
# get incoming parameters
local ($to, $from, $subject, $message, $file) = _;
# create a new message
$msg = MIME::Lite->new(
From => $from,
To => $to,
Subject => $subject,
Data => $message
);
# add the attachment
$msg->attach(
Type => "image/jpeg",
Path => $file,
Filename => $file,
Disposition => "attachment"
);
# send the email
MIME::Lite->send('smtp', 'email01.alinean.com',
Timeout => 60);
$msg->send();
}
it gives me a error on $msg->send();
not sure why
|
[1-3]
|
|