TSmtp, gmail, authentication

TSmtp, gmail, authentication

Postby Luis Krause » Fri Mar 08, 2013 5:42 pm

Hello all, long time since I've been around.

Back in the day I made several enhancements to TSmtp class and others
chimed in to implement authentication.

Until now I've never had a need for authentication, but now I do and
it isn't working quite right with gmail.

Here's the info I was provided:

smtp.gmail.com
Use Authentication: Yes
Port for TLS/STARTTLS: 587
Port for SSL: 465

So I do

oMail := TSmtp():New( cHost, if( lAuth, 587, 25 ), lAuth, cUser, cPass ) // [jlalin], IBTC

that is I set the port to 587 I get as far as the log shows, but I don't know where
does the SSL port 465 come into play and where do you use it:

02/04/13 16:08:01: Connect Socket handle: 552 WSA Error: 0
02/04/13 16:08:01: Write Socket handle: 552 WSA Error: 0
02/04/13 16:08:01: Read Socket handle: 552 WSA Error: 0
02/04/13 16:08:01: 220 mx.google.com ESMTP bg10sm13836353igc.6 - gsmtp

02/04/13 16:08:01: HELO smtp-client

02/04/13 16:08:01: AUTH LOGIN

02/04/13 16:08:01: Read Socket handle: 552 WSA Error: 0
02/04/13 16:08:01: 250 mx.google.com at your service

02/04/13 16:08:01: Read Socket handle: 552 WSA Error: 0
02/04/13 16:08:01: 530 5.7.0 Must issue a STARTTLS command first. bg10sm13836353igc.6 - gsmtp

02/04/13 16:18:01: Read Socket handle: 552 WSA Error: 0
02/04/13 16:18:01: 451 4.4.2 Timeout - closing connection. bg10sm13836353igc.6 - gsmtp

02/04/13 16:18:01: Close Socket handle: 552 WSA Error: 0


It's clear that the gmail server is expecting some new call after
530 5.7.0 Must issue a STARTTLS command first. bg10sm13836353igc.6 - gsmtp

but I don't know where/how to make it work.

Any suggestions are appreciated.
"May the Source be with GNU"
User avatar
Luis Krause
 
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada

Re: TSmtp, gmail, authentication

Postby ADutheil » Fri Mar 08, 2013 6:26 pm

My suggestion is to switch to hb_sendmail function. I´ve been using it successfully for a while with gmail accounts.
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: TSmtp, gmail, authentication

Postby reinaldocrespo » Fri Mar 08, 2013 10:12 pm

Luis;

Hi. The problem is that TSMTP with its authentication modifications, will authenticate by sending username and password as mime encoded strings. Mail servers such as gmail, work over ssl. TSMTP is not using ssl.

I think it is possible to send mail over ssl by using hb_sendMail() + linking tip.lib + tipssl.lib + libeay32.lib + ssleay32.lib. You will find information on how to build these libs on the xharbour ng. I'm currently using ssl to consume https webservices and I can tell you, it works!

I would love to see fw tsmtp class modified to use ssl. hb_sendmail() source can help.

Hope that gets you started on the right direction.


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 972
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: TSmtp, gmail, authentication

Postby Luis Krause » Sat Mar 09, 2013 2:05 am

Reinaldo, ADutheil

Thanks for the info on hb_sendmail().
I'll have to review it and figure it out.
And yes, if only TSmtp supported SSL.

Regards,
"May the Source be with GNU"
User avatar
Luis Krause
 
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 136 guests