Mar 07, 2008; 01:00
Seth Ganahl
SSL and SMTP
I am having a heck of a time trying to get Lasso to connect and send mail
using ssl. I'm using Lasso 8.5.5b5 on Mac OS X 10.5, and working off the
Tip of the Week here:
http://www.lassosoft.com/Documentation/TotW/index.lasso?9215
I've tried this:
<?LassoScript
var: 'auth_user' = encode_base64('my_user');
var: 'auth_pass' = encode_base64('my_pass');
Var: 'myEmail' = (Email_Compose:
-To='my_email@example.com',
-From='email@example.com',
-Subject='Testing SMTP',
-Body='Testing SMTP');
Var: 'myConnection' = (Net);
$myConnection->(SetEncoding: 'iso-8859-1');
Var: 'Result' = $myConnection->(Connect: 'smtp.example.com', 25);
Fail_If: $Result != Net_ConnectOK, -1, 'TCP Error';
Var: 'Result'=$myConnection->(Wait: 60, Net_WaitWrite);
Var: 'Capabilities' = $myConnection->(Read: 32768);
Fail_If: $Capabilities !>> '220', -1, 'Timed Out Waiting for Connection';
Var: 'Result' = $myConnection->(Write: 'EHLO 'server_name'\r\n');
Var: 'Capabilities' = $myConnection->(Read: 32768);
Fail_If: $Capabilities !>> '250', -1, 'No response to EHLO
command<br>'$Capabilities;
If: $Capabilities >> 'STARTTLS';
Var: 'Result' = $myConnection->(Write: 'STARTTLS\r\n');
$myConnection->(SetType: Net_TypeSSL);
/If;
/* This is where it dies */
Var: 'Result' = $myConnection->(Write: 'AUTH LOGIN\r\n');
Var: 'Result' = $myConnection->(Read: 32768);
Var: 'Result' = $myConnection->(Write: 'MAIL FROM:' + $myEmail->From +
'\r\n');
Var: 'Result' = $myConnection->(Read: 32768);
Fail_If: $Result !>> '250', -1, 'Invalid response to MAIL FROM ' + $Result;
Iterate: $myEmail->Recipients, (Var: 'myRecipient');
Var: 'Result' = $myConnection->(Write: 'RCPT TO:' + $myRecipient + '\r\n');
Var: 'Result' = $myConnection->(Read: 32768);
Fail_If: $Result !>> '250', -1, 'Invalid response to RCPT TO ' + $Result;
/Iterate;
Var: 'Result' = $myConnection->(Write: 'DATA\r\n' + $myEmail->Data +
'\r\n.\r\n');
Var: 'Result' = $myConnection->(Read: 32768);
Fail_If: $Result !>> '250', -1, 'Invalid response to MAIL FROM ' + $Result;
Var: 'Result' = $myConnection->(Write: 'QUIT\r\n');
$myConnection->Close;
?>
And I get this error: " SSL routines, SSL23_GET_SERVER_HELLO, unknown
protocol
at: Write with params: 'AUTH LOGIN\r\n'
at: /test.lasso on line: 28 at position: 33"
If I take out the STARTTLS bit I get a new and exciting error: "538 5.7.0
Encryption required for requested authentication mechanism" Which is what
I'd expect.
I've also tried using the email_smtp tag with the -ssl=true option, and
debugging turned on. With Lasso running in console mode I get this:
[03/06/08 23:59:41][1] SMTP OPEN array: (pair: (-host)=(smtp.example.com)),
(pair: (-port)=(25)), (pair: (-username)=(*****)), (pair:
(-password)=(*****)), (pair: (-ssl)=(true)), (pair: (-timeout)=(60))
[03/06/08 23:59:42][1] SMTP <- 220 smtp.example.com ESMTP Postfix\r\n
[03/06/08 23:59:42][1] SMTP -> EHLO [10.0.2.27]\r\n
[03/06/08 23:59:42][1] SMTP <-
250-smtp1.example.com\r\n250-PIPELINING\r\n250-SIZE
26522515\r\n250-ETRN\r\n250-STARTTLS\r\n250-ENHANCEDSTATUSCODES\r\n250-8BITM
IME\r\n250 DSN\r\n
[03/06/08 23:59:42][1] SMTP -> STARTTLS\r\n
[03/06/08 23:59:42][1] SMTP <- 220 2.0.0 Ready to start TLS\r\n
[03/06/08 23:59:42][1] SMTP ERROR EXPECTED GOT 220
[03/06/08 23:59:42][1] SMTP -> AUTH LOGIN\r\n
[03/06/08 23:59:42][1] SMTP <- 503 5.5.1 Error: send HELO/EHLO first\r\n
[03/06/08 23:59:42][1] SMTP ERROR EXPECTED 334 GOT 503
I'm so close...I know I am, but what am I missing?
-------------------------------------------------------
Seth C. Ganahl <seth@ganahlconsulting.com>
<http://www.ganahlconsulting.com>
-------------------------------------------------------
--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/