[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 :(

Something like this, but with more descriptive warnings.  This is an OLD 
example, and the only reason for calling Mac::InternetConfig  is to get 
the user's email address (obviously).  You could just as easily hard-code 
the sender:

#!perl -w

use strict;
use Net::SMTP;
use Mac::InternetConfig;

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

$smtp    = Net::SMTP->new();
$email   = $InternetConfig{kICEmail()};  # get sender from IC
@emails  = 'some_user@some.domain';      # recipient goes here
$subject = "Subject: MacPerl test message\n\n";
$message = <<EOM;

Place test message here

EOM

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

__END__

For further, more detailed info, consult the POD, and look up RFC821 for 
info on SMTP.

Otherwise, that's all there is to it.

--B


Brian McNett, Webmaster
*************************************************************
Mycoinfo. The world's first mycology e-journal.
http://www.mycoinfo.com/
*************************************************************


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