Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Problem passing ESMTP username/password through MIME::Enity

by gary kuipers (Beadle)
on Jan 18, 2003 at 21:58 UTC ( #228072=perlquestion: print w/replies, xml ) Need Help??

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

Need to send email via SMTP server that has username and password. Using MIME::Entity which uses smtpsend. The problem is I don't know how to pass the package the username and password. When I omit the "auth" line and use an SMTP server that does not require authentication this works like a charm.
sub sSendEmailMIME { use Mail::Internet; use MIME::Entity; my $retval = 0; my ($to,$from,$subject,$with,$encoding,$filename) = @_; if ( my $msg = MIME::Entity->build(From => $from, To => $to, Subject => $subject, Type => 'text/html', Encoding => "7bit", Path => "$filename", Filename => "$filename") ) { if ( $msg->smtpsend(Host => 'smtp.whatever.net') ) { $msg->auth ('me@whatever.net','123abc'); $retval = 1; print "sent\n"; } else { print "send FAILED: $!\n"; } } return $retval; }
This invariably gives me a "send FAILED" without explanation.

Thanks for your help.

Gary

Replies are listed 'Best First'.
Re: Problem passing ESMTP username/password through MIME::Enity
by jlongino (Parson) on Jan 19, 2003 at 05:31 UTC
    I notice that where you should have a login/username you put an email address instead: "me@whatever.net". Normally you would send just "me" as the login and then the password.

    I don't know if this will solve your problem or not, maybe when writing your post you typo'd the entire address instead of the login.

    --Jim

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2021-12-08 22:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (36 votes). Check out past polls.

    Notices?