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

Hi Monks and Jenda,

I've done a quite uncertain hack and need advise.

I use Mail::Sender and need auth with "LOGIN" protocol. But when I use it. It's directly jump to QUIT.

After about an hour of study, I found that my mail server response me AUTH=LOGIN on say hello stage,
so that sub say_helo couldn't phrase it with $self->{'supports'} = {map {split /\s+/, $_, 2} split /\n/, $res};.

Then I added this $myMailObj->{'auth_protocols'}{LOGIN} => 1; in my script and then it runs.

But my questions are :

Thank you very much!

Replies are listed 'Best First'.
Re: About Mail::Sender
by Jenda (Abbot) on Jul 17, 2012 at 07:49 UTC
    • yes
    • It should be OK this way. The say_helo() is supposed to find out what authentication protocols are supported by the server, but apparently it fails this time. I just checked and some servers return "AUTH LOGIN PLAIN" and some both "AUTH LOGIN PLAIN" and "AUTH=LOGIN PLAIN" as separate lines. I'll tweak the code to allow both whitespace and equals to separate the "AUTH" from the list.
    • No.
    • $self->{'supports'} = {map {split /(?:\s+|=)/, $_, 2} split /\n/, $res}; looks safer to me.

    According to RFC 1869 - SMTP Service Extensions (RFC1869) there should be a space, the RFC 2821 - Simple Mail Transfer Protocol says the same, but seems someone liked equals better ...

    The change will be in an upcoming version of Mail::Sender, for the time being either change the line in the module or set the $myMailObj->{'auth_protocols'}{LOGIN}. It doesn't matter much which. If you would set it for a protocol not supported by the server, the server will just report an error.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.

      Thanks man! I've made one simple wrapper class with optional protocol overrides ( plus some lazy methods ). I love your modules and looks forward for your update. :-)