MIME::Lite uses Net::SMTP to actually do smtp mail sending. But when trying to use it in my Win32 application, basically because it can handle authentication in the 3.01_05 version, I found that I was still not getting connections. As many ISP's block outgoing connections on port 25 we need to use alternative ports, 587 and 857 being commn.

After probing around in the code I found the solution was extremely simple and may save someone else some grief.

The list of options which will be passed is found in this array at line 2813. Port is not in it, so add it as I have done here and then it does just what it needs to.

my @_net_smtp_opts = qw( Hello LocalAddr LocalPort Port Timeout ExactA +ddresses Debug );
jdtoronto

Updated I noted this information here at the same time as posting to rt.cpan.org
Updated As suggested, has been marked up in AnnoCPAN, thanks diotalevi.

Replies are listed 'Best First'.
Re: MIME::Lite does not pass PORT to Net::SMTP
by diotalevi (Canon) on Aug 24, 2006 at 01:36 UTC

    Why don't you just file an http://rt.cpan.org bug against it? demerphq was the maintainer the last time I noticed. You could just as well get a fixed module. Also, consider marking it up on http://AnnoCPAN.org.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      Thanks diotalevi,

      I should have noted (which I have now done) that I sent this to http://rt.cpan.org before I posted here. The maintenance cycle for the module seems to be fairly slow, 3.01_05 - a developers release was in December 2005, the last general release was in April 2003. Although demerphq is listed as maintainer the most recent reference in the documentation, to the as yet non-existent 3.02, is from Sam Tregar.

      I placed this here so that anyone searching for the problem here would find a simple solution, I spent 2 or 3 hours on the issue, hopefully I can save others the same effort.

      jdtoronto

        There is a new maintainer. Give it some time while he gets caught up :)
Re: MIME::Lite does not pass PORT to Net::SMTP
by demerphq (Chancellor) on Aug 25, 2006 at 12:42 UTC

    A big problem for me with regard to supporting MIME::Lite is that people who send me bug fixes and the like tend not to follow up with feedback. For instance MIME::Lite has been at 3.01_05 for a long time, partly because I have received almost no feedback about 3.01_05 and whether it is production worthy.

    I will say that i keep meaning to take some time to make a last release before bart takes over full time maint. So...... Feedback about 3.01_05 would be nice. You are after all the only person I definitively know is using it.

    I admit that i havent given M::L the focus I should have. Hacking on perls regex engine has proved to be much more fun. :-)

    ---
    $world=~s/war/peace/g

Re: MIME::Lite does not pass PORT to Net::SMTP
by zentara (Cardinal) on Aug 24, 2006 at 15:40 UTC
    UPDATE Never mind I saw the post about the latest MIME::Lite

    I seem to remember talk about this recently, but it eludes me now. So I will mention using Net::SMTP_auth, which works with MIME::LITE. I know it's not exactly addressing the point of your post, but maybe the module author has a reason to keep auth and non-auth separate. ( Maybe because it works as it is? )

    #!/usr/bin/perl use warnings; use strict; use MIME::Lite; use Net::SMTP_auth; my $Servername = "mail.foobar.com"; my $Port = 587; my $Username = "z+foobar.com"; my $Password = "foobar-secret"; my $Auth_type = 'LOGIN'; #PLAIN, LOGIN, CRAM-MD5# my $msg = MIME::Lite->new( From => 'z@foobar.com', TO => 'zentara@zentara.net', Subject => 'Testing Text Message with auth', Data => 'How\'s it going. Sent with Net-SMTP_auth' ); #my $msgbody = $msg->as_string(); #my $smtp = Net::SMTP_auth->new($Servername, Port=> $Port ); my $smtp = Net::SMTP_auth->new($Servername, Port=>$Port, Debug => 1 ); $smtp->auth( $Auth_type, $Username , $Password ); $smtp->mail('zentara@zentara.net'); $smtp->to('zentara@zentara.net'); $smtp -> data(); $smtp -> datasend( $msg->as_string() ); $smtp -> dataend(); $smtp -> quit;

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum

      but maybe the module author has a reason to keep auth and non-auth separate.

      Auth came later. The original had no support for it.

      ---
      $world=~s/war/peace/g