[Israel.pm] Sending mail using MIME::Lite and SMTP server parameter

Webmaster @ SOI webmaster at secured.org.il
Thu Aug 19 12:23:55 PDT 2004


Found the problem : 

$msg->send('smtp', "smtp.server.com");

Thanks


> -----Original Message-----
> From: perl-bounces at perl.org.il 
> [mailto:perl-bounces at perl.org.il] On Behalf Of Webmaster @ SOI
> Sent: Thursday, August 19, 2004 9:09 PM
> To: perl at perl.org.il
> Subject: [Israel.pm] Sending mail using MIME::Lite and SMTP 
> server parameter
> 
> 
> 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'
>                  );
> 
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
> 




More information about the Perl mailing list