On Thursday 24 June 2004 22:43, Mike Blezien wrote:
> Hello,
>
> I'm looking at using the Net::SMTP module to send email as opposed to the
> standard method of "sendmail".
>
> Been reading through the docs on the module, but not real clear on how to
> setup the "To:", "From:", "Reply-to:", "Subject:". and other headers, and
> actual body of the email to be sent, with this module.. was hoping someone
> maybe kind enough to maybe post a sample of code, using this module.

Hi Mike,

is there a specific reason for using Net::SMTP?
I haven't worked with Net::SMTP so far, but from what you're writing, it seems 
to me as if Mail::Sender would be a more simple alternative ;-)

#!/usr/bin/perl -w

use strict;
use Mail::Sender;

my $mail_sender = new Mail::Sender {
        smtp => 'name.of.your.mail.server',
        from => '[EMAIL PROTECTED]'
};

$mail_sender->MailMsg(
        {to => '[EMAIL PROTECTED]',
          subject => 'Test',
         msg => 'This is from Mail::Sender'
        }
)
  or die "cant send message - error code : $Mail::Sender::Error. Stopped";

$mail_sender -> Close();

__END__

see perldoc Mail::Sender for details.

HTH,

Philipp

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to