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

[MacPerl] SMTP emailing works fine!



Thanks to everyone who helped out with my problems sending
email with MacPerl.  The fundamental problem was I had
MacPerl allocated 4MB of RAM, so I changed that to 8MB and
it worked fine.

My POP host is hardcoded in the Config.pm module.

I chose not to use Internet Config.

I also learnt that extra header lines need to be included
in the message such as To: and From:  These are included
in the $subject variable.  An email message has a header
followed by two \n characters then the body of the message.


#!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';

@emails='charles@mpx.com.au';
$subject = "From: Charles Cave <charles\@mpx.com.au>\nSubject: 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');
$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";
_END_


Here is the message I got. Note that a To: line is
missing, and this could be included in the $subject string.


>X-From_: mpx.com.au!charles Mon Aug 23 22:42:04 1999
>Date: Mon, 23 Aug 1999 22:42:03 +1000
>Apparently-To: <charles@mpx.com.au>
>From: Charles Cave <charles@mpx.com.au>
>Subject: My test message
>
>MacPerl sent this message. Nifty eh??
>Please confirm receipt to charles@mpx.com.au
>Many thanks!!!


Now I can go back and play with the GD graphics library!!

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