Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^2: Mime::Lite and SMTP authentication?

by tirwhan (Abbot)
on Jan 25, 2010 at 08:57 UTC ( #819428=note: print w/replies, xml ) Need Help??

in reply to Re: Mime::Lite and SMTP authentication?
in thread Mime::Lite and SMTP authentication?

If your providers server listens on port 465 (as indicated in the code snippet above), it almost certainly expects an SSL connection (465 is the universally accepted port for SMTPS,i.e. SMTP over SSL). AFAIK you can't use SSL in conjunction with the MIME::Lite send() method (or rather, you probably could but it's more trouble than it is worth), so you'll need to use something like Net::SMTP::SSL for sending. You can still use MIME::Lite for constructing the message. For example (untested):

#!/usr/bin/perl use strict; use warnings; use MIME::Lite::TT::HTML; use Net::SMTP::SSL; my %params; my %options; $options{INCLUDE_PATH} = 'c:/Documents and Settings/Uriel/My Documents +/Sandbox/perl/'; my $msg = MIME::Lite::TT::HTML->new( From => '', To => '', Subject => 'Hello world', Template => { text => 'test.txt', html => 'test.html', }, TmplOptions => \%options, TmplParams => \%params, ); my $smtp; $smtp = Net::SMTP::SSL->new($host, Port=>465) or die "Can't connect"; $smtp->auth($user, $pass) or die "Can't authenticate:".$smtp->message( +); $smtp->mail('') or die "Error:".$smtp->message(); $smtp->to('') or die "Error:".$smtp->message(); $smtp->data() or die "Error:".$smtp->message(); $smtp->datasend($msg->as_string) or die "Error:".$smtp->message(); $smtp->dataend() or die "Error:".$smtp->message(); $smtp->quit() or die "Error:".$smtp->message();

All dogma is stupid.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://819428]
[Discipulus]: choroba thanks but that sequence uses Unicode codepoint, not ascii number
[choroba]: ASCII is subset of unicode
[1nickt]: hi trippledubs, nice to see you again.
[1nickt]: karlgoethebier that would be "trying out" German that I remember from long ago!
1nickt used to be in a meatspace monastery, in EU, with lots of wanderers from all over the world ...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2017-12-13 13:06 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (366 votes). Check out past polls.