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

[MacPerl] Problems with SMTP sending an email message



Here is a program I copied from MPPE to send email.  I'm having trouble
with it because after I ran it once, my Mac froze up. 

I installed SMTP.pm and Config.pm from a libnet distribution I found
on one of my Zip disks. The comments indicated it was ported from
Unix to MacPerl by Paul Schinder.

What tweaking should I do to make it work?

Thanks
Charles Cave
charles@irg.com.au

-----------------------------------------------------------------------------

#!perl -w
use strict;
use Net::SMTP;
my($smtp, $email, @emails, $subject, $message);
print "Creating the new message\n";

$smtp = Net::SMTP->new();
$email = "charles\@mpx.com.au";   # My home address
@emails="charles\@irg.com.au";    # My offiec address
$subject = "Subject: My test message\n\n";
$message = <<EOM;
MacPerl sent this message. Nifty eh??
Please confirm receipt to charles\@mpx.com.au
Many thanks!!!
EOM

$smtp->mail($email)       or warn('failure 1');  # Line 18
$smtp->to(@emails)        or warn('failure 2');
$smtp->data()             or warn('failure 3');
$smtp->datasend($subject) or warn('failure 4');
$smtp->datasend($message) or warn('failure 5');
$smtp->dataend()          or warn('failure 6');
$smtp->quit()             or warn('failure 7');

print "Finished\n";

------------------------------------------------------------------------------------
And here is the message I received at the office. Note that the
sender's name did not appear in the email header.
------------------------------------------------------------------------------------

Sun, 22 Aug 1999 23:20:54 +1000
Apparently-From: charles@mpx.com.au
Apparently-To:  <charles@irg.com.au>
Subject:  My test message



MacPerl sent this message. Nifty eh??
Please confirm receipt to charles@mpx.com.au
Many thanks!!!

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