Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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 => '') ) { $msg->auth ('','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.


In reply to Problem passing ESMTP username/password through MIME::Enity by gary kuipers

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2022-01-16 21:26 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (50 votes). Check out past polls.