Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Mail::Send usage question

by fmogavero (Monk)
on Jul 23, 2001 at 22:50 UTC ( [id://99124]=perlquestion: print w/replies, xml ) Need Help??

fmogavero has asked for the wisdom of the Perl Monks concerning the following question:

This script dies at Mailer.pm line 270.

Can someone explain why? I am at work where they use Exchange for the e-amil system.

Here's the code:

require Mail::Send; $msg = new Mail::Send; $msg->to('fmogo@mninter.net'); $msg->subject('Send Mail Test'); $msg->delete($header); $fh = $msg->open or die "Couldn't open message: $!" ; print $fh "Just testing the Mail::Send package"; $fh->close;

Replies are listed 'Best First'.
Re: Mail::Send usage question
by wine (Scribe) on Jul 23, 2001 at 23:06 UTC
    I find no problems with it. I even accidenty mailed fmogo@mninter.net. ;)

    I guess it's a problem with your exchange server or you reaching it.

    Update 2 By default Send.pm uses Mailer.pm which by default uses mail or sendmail to deliver your message. You might want to try explicitly specifying your smtp-server and thereby implicitely using Net::SMTP. You're not dependent on mail or sendmail being installed, which is I guess cause of the 270-error.

    require Mail::Send; $msg = new Mail::Send; $msg->to('fmogo@mninter.net'); $msg->subject('Send Mail Test'); $msg->delete($header); $fh = $msg->open('smtp', Server => "smtp.uu.nl") or die "Couldn't open + message: $!" ; print $fh "Just testing the Mail::Send package"; $fh->close;

    Perhaps this works.

Re: Mail::Send usage question
by Agermain (Scribe) on Jul 24, 2001 at 00:32 UTC

    I think I had a similar problem with our own mailserver. You may need to specify an on-site email address for the $msg->from() field. For example, if your site were yoursite.com and your SMTP server is exchange.yoursite.com , you might need to give it an valid address like yourname@yoursite.com in order for Exchange to let it pass. I'm guessing this is one of Exchange's security settings (believe it or not, I think MS actually thought about this issue!)

    - andre

Re: Mail::Send usage question
by theharry (Sexton) on Jul 23, 2001 at 22:59 UTC
    Perhaps it is because you are deleting the header before you are sending the message, or because your exchange server is not allowing you through.

    You might also need a from line to satisfy the server

    try removing the delete line first...

    theharry

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://99124]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-03-29 05:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found