[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Net::SMTP



> hello!
> 
> maybe somebody know where i can get working example of subj.
> i'm still having problems :(
>
>
> trakais

Hello Trakais,

This is straight out of the Perl Cookbook (I think) and works for me.

Good luck,

Elton

----------

#!/usr/local/bin/perl

#
# program: mailmac
#

use strict;
use Net::SMTP;

my ($smtp, $email, @emails, $subject, $message);

$smtp = Net::SMTP->new('your.mailserver.org',
                  Hello => 'ehughes@novapic.org',
                  Timeout => 30,
                  Debug   => 1,
                );
$email = 'ehughes@novapic.org';
@emails = 'ehughes@novapic.org';
$subject = "Subject: Test Message\n\n";
$message = <<EOM;
MacPerl sent this message. I hope it works!

email->$email
email->@emails
subject->$subject

Just testing to see if variables can exist in here statements
EOM

$smtp->mail($email)   or warn('failure');
$smtp->to(@emails)    or warn('no to');
$smtp->data()     or warn('no data');;
$smtp->datasend($subject)  or warn('no subject');
$smtp->datasend($message)  or warn('no message');
$smtp->dataend()    or warn('no dataend');
$smtp->quit()     or warn('no quit');

----------

=========================================================================
NOVA Private Industry Council                 505 W. Olive Ave. Suite 550
Elton Hughes (Information Technology)                  Sunnyvale CA 94086
Phone: 408-730-7235                                     Fax: 408-730-7643
-------------------------------------------------------------------------



# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org