[Israel.pm] Sending mail using MIME::Lite and SMTP server parameter
Webmaster @ SOI
webmaster at secured.org.il
Thu Aug 19 12:09:25 PDT 2004
Hi List,
I'm kind of newbie to Perl and trying to use the MIME::Lite library
In order to send mail from Perl under RH9 Linux.
The thing is that I need to specify an SMTP server
As I understood from the MIME::Lite and Net::SMTP man
I can pass the SMTP server parameter to the new() function.
What I don't understand is how to combining them ...
The Net::SMTP says :
new('mailhost');
And the MIME::Lite says :
send_by_smtp ARGS...
Instance method. Send message via SMTP, using Net::SMTP. The optional
ARGS are sent into Net::SMTP::new(): usually, these are
MAILHOST, OPTION=>VALUE, ...
Does anyone knows how can I combine the to so I can send a mail using
MIME::Lite with SMTP parameters ?
Below the base script I use :
Thanks for any help
#!/usr/bin/perl -w
use strict;
use FileHandle;
use warnings;
use MIME::Lite;
use Net::SMTP;
my $msg;
### Create the multipart "container":
$msg = MIME::Lite->new(
From =>'user at mydomain.com',
To =>'user at rcvdomain.com',
Subject =>'A message with 2 parts...',
Type =>'multipart/mixed'
);
### Add the text message part:
### (Note that "attach" has same arguments as "new"):
$msg->attach(Type =>'TEXT',
Data =>"Here's the GIF file you wanted"
);
### Add the image part:
$msg->attach(Type =>'TEXT/html',
Path =>'/home/user/file.html',
Filename =>'file.html',
Disposition => 'attachment'
);
More information about the Perl
mailing list