TSmtp, gmail, authentication

Post Reply
User avatar
Luis Krause
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada

TSmtp, gmail, authentication

Post by Luis Krause »

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"
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: TSmtp, gmail, authentication

Post by ADutheil »

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 BCC 5.82 MinGW 4.5.2 MSVS 10
User avatar
reinaldocrespo
Posts: 918
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: TSmtp, gmail, authentication

Post by reinaldocrespo »

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
Luis Krause
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada

Re: TSmtp, gmail, authentication

Post by Luis Krause »

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"
Post Reply