PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD23] Something wrong with protected email sending
[WD23] Something wrong with protected email sending
Débuté par Ola, 05 juin 2018 13:03 - 5 réponses
Posté le 05 juin 2018 - 13:03
I had owerwhelming difficulties trying to send protected email with WD21. Now I have been trying the same with WD23 (with the new "multiplatform" setting "EmailConfigure(emailParameterMode, 1)"), but with equally bad results.

I have no problem sending protected emails with Pegasus email client, but when I try and use the same (or any other) settings in WD, no luck.

With WD I can only send emails using the phone operator's general, unprotected SMTP server using the simpliest syntax:
bSessionOk is boolean = EmailStartSMTPSession(sUser,sServerAddress)

The more complex syntaxes that I would need to use with my ISP's protected server do not work at all, eg.:
bSession is boolean = EmailStartSMTPSession( sUser, sPassword, sServerAddress, iPort, bAsyncMode, emailOptionSecuredTLS)

I have also tried with "optionSSL" and with and without "EmailConfigure(emailParameterMode, 1)"

Timeout has been set to 30. Have tried in Win 7 and XP.

//Code for connection error checking:
IF not bSessionOk THEN HourGlass(False) DelayBeforeClosing(gClosingDelay) Error("Connection to SMTP server failed",EmailMsgError(Email.Error)) RESULT False END //SMTP connection failure messages with different settings:
//---------------------------------
//SSL,30,465,NoMulti,NoAsync:
//Execution in 16-bit mode or attachment names unknown.
//
//TLS,30,465,NoMulti,NoAsync:
//SMTP Session: connection failed. No server response.
//
//SSL,30,465,MultiPlatform,NoAsync:
//Execution in 16-bit mode or attachment names unknown.
//
//TLS,30,465,MultiPlatform,NoAsync:
//SMTP Session: connection failed. No server response.
//
//
//SSL,30,465,NoMulti,Asyncronous sending:
//Just failure, NO MESSAGE!
//
//TLS,30,465,NoMulti,Asyncronous sending:
//Just failure, NO MESSAGE!
//
//SSL,30,465,MultiPlatform,Asyncronous sending:
//Just failure, NO MESSAGE!
//
//TLS,30,465,MultiPlatform,Asyncronous sending:
//Just failure, NO MESSAGE!

//The actual sending is done like this:
bOK is boolean = EmailSendMessage(sUser,emailOptionEncodeHeader)
- but the program gets this far only when sending to an unprotected server, and then it works...

I am losing my gray hair with this. Has anybody been able to send protected emails with WD? I would really appreciate some hints and tips to get over this problem.

Best regards
Ola
Posté le 05 juin 2018 - 15:01
Hi Ola,

I do that all the time without any problem in webdev in asynchronous mode and in windev in synchronous mode...

of course, the parameters to use DEPEND on the SMTP server you are using (I'm using the gmail server)...

You have an example of my code in the EMAIL class of clWXreplication (used to return bug report, by example)

Best regards
Posté le 05 juin 2018 - 21:17
Hi Fabrice,

Thanks. I'll have a look at your email class.
I am just flabbergasted by the fact that the settings
that work in Pegasus, do not work in WD.

Best regards
Ola
Posté le 06 juin 2018 - 00:43
Hi Fabrice,

I had a look at your email sending code, and -- correct me if I am wrong -- it seems that it is actually sending unsecured email, not secured. Port 25, which you are using, is the default port for unsecured SMTP, and you are not specifying the securing parameter ("emailOptionSecuredTLS" or "optionSSL").

TLS is the currently used default method for sending secured emails, and the default/recommended port for that is 587.

SSL (with default/recommended port 465) seems to be obsolete.

It just occurred to me that I may have the port 587 closed in my firewall, and therefore my secured email sending does not work. I'll check that later to day.

Best regards
Ola
Posté le 06 juin 2018 - 12:35
Hi Ola,

maybe in the wxreplication example I left the 'standard' settings... But I'm using the same code for protected email on gmail on port 587 and tls/ssl, and I'm using the same settings than in thunderbird...

However, be aware that some email providers are tightening security and force you to declare your application in their security settings in order to allow it to send (you then get another password for it).

Best regards
Posté le 06 juin 2018 - 19:46
Hi Fabrice,

I got it working. Of course there was no problem with the firewall, because Pegasus was working. And my code was OK. I had simply entered wrong port value in the email account maintenance form. My bad:rolleyes: Sorry for the noise and thanks for the help.

The good side of this was that I learned a couple of things about SMTP mail sending:-)

Best regards
Ola