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

Re: [MacPerl] A problem with mail



I have tried SMTP, as in your example. It works fine with two exceptions.
    1. There is no "To:" header.
    2. No descriptor will appear in the "From:" header.
       E.g.,
          @emails  = 'Bugs Bunny <bugs@luneytoons.com>';
       comes though as
          From: bugs@luneytoons.com

In any case my question remains the same. Why won't Barr's Mail work? 
Have any of you MacPerl users been able to use smtpsend from 
Mail::Internet?

Regards,

Vic

At 12:01 AM -0500 11/21/00, Scott R. Godin wrote:
>on 11/20/2000 09:47 PM, Vic Norton at norton@tweney.com wrote:
>  > I've just tried to install Graham Barr's "MailTools-1.1002" from the
>>  MacPerl CD-ROM. I dropped the "Mail" folder into my "site_perl"
>>  folder. "Mail" contains both "Header.pm" and "Internet.pm".
>>
>>  However I haven't been able to send any mail. Every time I try I get
>>  the error message
>>  # Can't locate auto/Mail/Internet/smtpsend.al in @INC.
>>  File 'IntHD:Languages:MacPerl Ÿ:lib:AutoLoader.pm'; Line 38
>>  ( Line 38 is:   eval {require $name}; )
>>
>  > What is the problem? I can't figure it out. Does anyone have any ideas?
>  >
>  > ...
>  >
>>  ---------------------- my script follows -------------------------
>>  use Mail::Internet;
>>  use Mail::Header;
>>  $ENV{SMTPHOSTS} = 'mail.dacor.net';
>>
>>  my ($header, $body, $mail);
>>
>>  # create headers
>>  $header = new Mail::Header;
>>  $header->add('To', 'Vic Norton <norton@bgnet.bgsu.edu>');
>>  $header->add('From', 'Vic Norton <norton@tweney.com>');
>>  $header->add('Subject', 'Mail::Test');
>>  $header->add(undef, 'X-Norton-URL: <http://www.tweney.com/norton/>');
>>
>>  # create body
>>  $body = 'This is a test, ignore';
>>
>>  # create mail object
>>  $mail = new Mail::Internet(undef, Header => $header, Body => \[$body]);
>>
>>  # send it
>  > $mail->smtpsend or die;  # this is where the problem is
>>
>
>you might find this script simpler and easier for SMTP
>
>#!perl
># use the -w switch and Types.pm under MacPerl complains of an uninitialized
># value. (commenting out the use Net::SMTP; line eliminates the error when
># syntax checking. This is a known issue. you can use -w and ignore
># the warning if you like.)
>use strict;
>use Net::SMTP;
>use Mac::InternetConfig;
>my($smtp, $email, @emails, $subject, $message);
>
>$smtp    = Net::SMTP->new();
>$email   = $InternetConfig{kICEmail()}; # my address
>@emails  = 'nowhere@devnull.com';
>$subject = "Subject: testing MacPerl SMTP access\n\n";
>$message = <<EOM;
>
>MacPerl sent this message.  Nifty, eh? :-)
>
>Just another Perl Hacker hard at work. =]
>
>EOM
>
>$smtp->mail($email)       or warn('failure'); #simple fail msg
>$smtp->to(@emails)        or warn('failure'); #use what you like
>$smtp->data()             or warn('failure');
>$smtp->datasend($subject) or warn('failure');
>$smtp->datasend($message) or warn('failure');
>$smtp->dataend()          or warn('failure');
>$smtp->quit()             or warn('failure');
>
>__END__
>
>--
>Scott R. Godin            | e-mail : mactech@webdragon.net
>Laughing Dragon Services  |    web : http://www.webdragon.net/

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