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

Re: [MacPerl] Problems with SMTP sending an email message



On Mon, 23 Aug 1999 09:42:54 +1000, Charles Cave wrote:
>
>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. 

Generally when your Mac freezes after running a MacPerl script, it's
because you haven't given MacPerl enough memory. The default allocation is
*not* enough to do any serious work with modules.

>
>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.

Of course not, since you didn't provide those headers. The only thing
you've provided is the SMTP protocol's MAIL FROM and RCPT TO addresses,
which need have nothing to do with what appears in the From: or To:
headers. Net::SMTP implements the SMTP protocol, and doesn't do headers.
If you want those kinds of headers, put them in $subject before Subject:.
Apparently the script worked and then MacPerl ran out of memory.
Increasing the memory partition should stop the freezing.

>--------------------------------------------------------------------------
----------

>
>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!!!
>

>

-------
Paul J. Schinder
schinder@pobox.com


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