Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: Re: Extending MIME::Lite

by trs80 (Priest)
on Sep 27, 2003 at 14:24 UTC ( #294646=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Extending MIME::Lite
in thread Extending MIME::Lite

The else doesn't need to be there. The $smtp is still going to need to be created in the same way (or at least it seems so to me). The authentication action occurs after the Net::SMTP object has been created, which was part of my initial concern when adding support to MIME::Lite. I am still working through why Net::SMTP doesn't allow for the authentication arguments in the object creation. It would seem that Net::SMTP should perhaps be the one that bends and allows for the authenication to be passed into it on object creation.

If we moved this logic into the Net::SMTP module, what would happen if we did this right before we return the Net::STMP object:
if (defined $arg{User}) { $obj->auth($arg{User},$arg{Password}); }
inside of the Net::SMTP new? Then when we create a new Net::SMTP call we do it as:
MIME::Lite->send('smtp', $out_smtp , Port =>$smtp_port , Timeout=>60 , Debug => $debug , Hello => 'domain.com', User => 'trs80', Password => 'blah' );
My simple test indicates that it works, but I need to carefully review the side effects of performing the auth in the object creation.

Placing the change inside of Net::SMTP makes more sense in that it keeps the logic in the right problem space and thereby making it benefical to a larger user base.


Comment on Re: Re: Re: Extending MIME::Lite
Select or Download Code
Re: Re: Re: Re: Extending MIME::Lite
by demerphq (Chancellor) on Sep 28, 2003 at 01:04 UTC

    The else doesn't need to be there. The $smtp is still going to need to be created in the same way (or at least it seems so to me).

    Key term here is need. Yes you are correct it doesnt need to be there, but the idea I had was that this extension is not only going to cover the case of authentication. One thing I would like to do is implement smart hosts. The user should be a able to supply a list of SMTP hosts and have MIME::Lite cycle through them until it manages to send its mail. So for what I have in mind keeping the simple case seperate from the more complex case makes sense.

    Placing the change inside of Net::SMTP makes more sense in that it keeps the logic in the right problem space and thereby making it benefical to a larger user base.

    Agreed. However I think you may be waiting a while before such a patch is implemented. Probably longer than it will take to go into MIME::Lite. If MIME::Lite does its own ting, and then sometime down the path Net::SMTP is altered as you say then MIME::Lite can be modified accordingly. Until that day Id rather think about what is directly under my control than what would be possible when a patch is applied to a module I have no control over.


    ---
    demerphq

      First they ignore you, then they laugh at you, then they fight you, then you win.
      -- Gandhi


Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://294646]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2014-12-20 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (96 votes), past polls