PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → WD18 E-mails via a secure connection
WD18 E-mails via a secure connection
Iniciado por guest, 29,nov. 2014 20:18 - 16 respuestas
Publicado el 29,noviembre 2014 - 20:18
Hi Everybody,

how can I send E-mail with a secure Connection (<a class="ExternalLink" rel="nofollow" target="_blank" href="http://www.strato-faq.co.uk/article/118/Can-I-send-my-e-mails-via-a-secure-connection">http://www.strato-faq.co.uk/article/118/Can-I-send-my-e-mails-via-a-secure-connection</a>-(SSL-or-TLS).html)

I using this code:

MySession..ServerAddress = EDT_PostausgangsserverSMTP
MySession..Name = EDT_Benutzername
MySession..Password = EDT_Kennwort
MySession..Port=465
MySession..Option = emailOptionSecuredTLS

But I can't connect to the E-Mail account.
I get this error:
SMTP Session: connection failed. No server response.
Timeout:
No server response within timeout.
Error code: 100042
Level: non-fatal error (EL_ONRETURN)
Dump of the error of 'wd180com.dll' module (18.0.81.0).

E-Mails received works great. Before Strato has changed, it works without problems.

PCSoft of course, has no idea why :mad:.
Publicado el 29,noviembre 2014 - 21:26
Hi

Considering that you are not providing us with the whole code, and that you are even not showing use the value of the parameters (I am mot talking about the password, of course), I don't see how we could possibly help you... And if that is the information you gave to pcsoft, I don't see how THEY could possibly help you either

Best regards
Publicado el 29,noviembre 2014 - 23:19
Fabrice, it is a very simple code! That is the rest off the code:

MySession is a EmailSMTPSession
MyMessage is a Email


EmailSetTimeOut(15) // 15 seconds time-out

IF EmailStartSession(MySession) = True THEN
EmailSetTimeOut(10*60) // Reset to 10 minutes
ELSE
Error("Keine Verbindung möglich: "+ErrorInfo(errFullDetails))
RETURN
END

MyMessage.Sender = EDT_EMailAdresse
MyMessage.SenderAddress=EDT_EMailAdresse
MyMessage.Recipient[1]=EDT_EMailAdresse
MyMessage.Subject = "Testnachricht"
MyMessage.Message = "Diese E-Mail-Nachricht wurde gesendet, um Ihre SMTP/POP3 Konto-Einstellungen zu testen."
MyMessage.HTML = ""


EmailSendMessage(MySession,MyMessage)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
EmailCloseSession(MySession)

Info("Es wurde Ihnen eine Testnachricht gesendet")
END
HourGlass(False)

There are no secrets. I suspect secure smtp does not work with WD 18 (19?)
Publicado el 29,noviembre 2014 - 23:41
"And if that is the information you gave to pcsoft, I don't see how THEY could possibly help you either"

It could be that the Bug in WD 19 are fixed. But probably I hope too much.<img src="/NG2013_WEB/ui/smiley/2.gif" align=absmiddle border=0 alt=":-(">
Publicado el 30,noviembre 2014 - 13:20
Hi Again

I have been using secure email sending since version 16 (at least) with by example gmail, so that is NOT the problem.

However, I look at your code, and I don't see you specifying ANY information about the smtp session.. Which probably means that once again, you are not showing us ALL your code...

But in any case, with what you showed us, I can already tell you that there is one problem, as the help specifies clearly:
>>To start a session for sending emails (SMTP protocol only), use EmailStartSMTPSession. This function can also be used to start an authenticated SMTP session.

the second part of the paragraph is the key... you cannot start a secure session with emailstartsession, you need to use emailstartsmtpsession and make sure that you specify ALL the appropriate parameters

Best regards
Publicado el 30,noviembre 2014 - 16:08
Again, too. This is a simple code to test the SMTP connection. I created with PCSOFT this code. Apparently, the "Hotline" has no idea.
I'll try your Suggestion.
Publicado el 30,noviembre 2014 - 16:42
Hi, I have the same problem, I need send a e-mail using secure connection (Italian Pec) but it is impossible. I had tried all possible code but it not work. It not work also with windev 19. I have resolved sending mail using outlook connection (in windev there is a complete example how use it).
I am not happy for this solution but I need to resolve the problem. I use pcsoft tools for almost six years but the PCSOFT support not has resolved nothing. I gave up asking for help. If you find a solution please send a mail to me.
Thanks
Maurizio
Publicado el 30,noviembre 2014 - 17:02
Hi Maurizio,

I thought I was alone!
The idea from Fabrice doesn't work. I thought so, but I was hoping for a miracle:

UserName is string

UserName = "blablabal@blablabal.de"
// Send an email via the secure SMTP protocol
EmailSetTimeOut(10) //10 seconds for the time-out
// Use a secure SMTP server with authentication
// Required to use a SMTP
// that differs from the one of the ISP


EmailStartPOP3Session(UserName,"blablabal","pop3.strato.de",995,optionSSL)

IF ErrorOccurred THEN
Error ("POP3 "+ErrorInfo(errFullDetails))
RETURN
ELSE
Info("POP3 Works great")
END

The answer is "POP3 Works great"

// Next do SMTP...

EmailStartSMTPSession(UserName,"blablabal","smtp.strato.de",465,False,emailOptionSecuredTLS)

IF ErrorOccurred THEN
Info ("SMTP "+ErrorInfo(errFullDetails))
RETURN
ELSE
Info("SMTP Works great")
END

The answer is:
---------------------------
E-Mail-Konten
---------------------------
SMTP WL call:
Process of 'Click BTN_NoName2' (WIN_Form_EMailKonten.BTN_NoName2), line 29, thread 0
'EmailStartSMTPSession' function, syntax 7

What happened?
SMTP Session: connection failed. No server response.
Timeout:
No server response within timeout.

Error code: 100042
Level: non-fatal error (EL_ONRETURN)

Dump of the error of 'wd180com.dll' module (18.0.81.0).
Debugging information:
Fonction (10,70)
Additional Information:
EIT_PILEWL :
Click BTN_NoName2 (WIN_Form_EMailKonten.BTN_NoName2), line 29
EIT_DATEHEURE : 30/11/2014 16:52:12

The same error with my old code! What a nonsens!
The error is due to the TLS option. The SSL option with the POP3 access works. PCSoft must implement an SSL option for SMTP.
But this will not happen, beautiful women are more important.
Publicado el 01,diciembre 2014 - 00:54
Hi

Just to confirm what Fabrice says, I have been using WD19 to connect to a secure SMTP email server for quite some time. I can guarantee it works.

Rgds
Paul
Publicado el 01,diciembre 2014 - 08:01
Hi Paul can you send us the code used for your test ?.
I have tried many times but I don't resolved.
Tanks in advance
Maurizio
Publicado el 01,diciembre 2014 - 09:38
Hi,

I'm using secure SMTP already since V16 in a lot of my apps... No problem whatsoever...
Note that secure SMTP doesn't use the default port 25. Also often internet providers block the low range of ports for connections coming from another network.

Hence the following questions:
- Are you using port 587 for your secure SMTP?
- Are you connecting to an SMTP service that is on a remote network (not the one from your internet provider)?
- Can you get the SMTP connection to work from a command window using telnet (so outside of WX)?

Best regards,

Peter H.
Publicado el 01,diciembre 2014 - 11:08
Sample code using hotmail and TLS working in WD18:

IF NOT EmailStartSMTPSession("xxxx@hotmail.com","your_password","smtp.live.com",587,False,emailOptionSecuredTLS) THEN
Error("Error "+ErrorInfo())
ELSE
Info("OK")
END

EmailCloseSession("xxxx@hotmail.com")
Publicado el 01,diciembre 2014 - 14:34
Hi Netapp,

Your error message is: "No server response within timeout."

I use TSL since years too and it works very well. Your error is very obvious: the socket connection fails. Your connection never gets answered. If you had a TLS problem you would get an according message.

This message tells you your call is dead. Either the port is wrong or the server address or something (firewall, bad port forward of natting, etc) blocks the outgoing or incoming answer of the socket connection.

Best regards,
Alexandre Leclerc
Publicado el 01,diciembre 2014 - 18:07
Hi Alexandre,

I switch off the Windows firewall and all ports on my hardware Firewall are open (any to an)y. No works.

But it can not be, because Life Mail an Outlook 2010 works without these settings.

I suspect Strato uses the older SSL protocol and not the newer TLS protocol .
Therefore, the POP3 SSL connection (995) works with EmailStartPOP3Session()

Regards

Netapp
Publicado el 01,diciembre 2014 - 18:35
Hi All,

Port 587:

---------------------------
E-Mail-Konten
---------------------------
SMTP WL call:
Process of 'Click BTN_NoName2' (WIN_Form_EMailKonten.BTN_NoName2), line 29, thread 0
'EmailStartSMTPSession' function, syntax 7

Error code: 0
Level: non-fatal error (EL_ONRETURN)

Debugging information:
Fonction (10,70)
Additional Information:
EIT_PILEWL :
Click BTN_NoName2 (WIN_Form_EMailKonten.BTN_NoName2), line 29
EIT_DATEHEURE : 01/12/2014 18:32:58

Port 25 with emailOptionSecuredTLS:
---------------------------
E-Mail-Konten
---------------------------
SMTP WL call:
Process of 'Click BTN_NoName2' (WIN_Form_EMailKonten.BTN_NoName2), line 29, thread 0
'EmailStartSMTPSession' function, syntax 7

Error code: 0
Level: non-fatal error (EL_ONRETURN)

Debugging information:
Fonction (10,70)
Additional Information:
EIT_PILEWL :
Click BTN_NoName2 (WIN_Form_EMailKonten.BTN_NoName2), line 29
EIT_DATEHEURE : 01/12/2014 18:34:06

Port 25 without emailOptionSecuredTLS:

---------------------------
E-Mail-Konten
---------------------------
SMTP WL call:
Process of 'Click BTN_NoName2' (WIN_Form_EMailKonten.BTN_NoName2), line 29, thread 0
'EmailStartSMTPSession' function, syntax 6

What happened?
The last response of SMTP server is:
<538 5.7.11 Authentifizierung nicht moeglich, bitte benutzen Sie eine Verbindung mit SSL/TLS Verschluesselung (siehe auch <a class="ExternalLink" rel="nofollow" target="_blank" href="http://strato-faq.de/artikel.html?id=171">http://strato-faq.de/artikel.html&hellip;</a>
>

Error code: 0
Level: non-fatal error (EL_ONRETURN)

Dump of the error of 'wd180com.dll' module (18.0.81.0).
Debugging information:
Fonction (10,70)
Additional Information:
EIT_PILEWL :
Click BTN_NoName2 (WIN_Form_EMailKonten.BTN_NoName2), line 29
EIT_DATEHEURE : 01/12/2014 18:34:49
Publicado el 01,diciembre 2014 - 18:38
Hi All,

Port 587:

---------------------------
E-Mail-Konten
---------------------------
SMTP WL call:
Process of 'Click BTN_NoName2' (WIN_Form_EMailKonten.BTN_NoName2), line 29, thread 0
'EmailStartSMTPSession' function, syntax 7

Error code: 0
Level: non-fatal error (EL_ONRETURN)

Port 25 with emailOptionSecuredTLS:
---------------------------
E-Mail-Konten
---------------------------
SMTP WL call:
Process of 'Click BTN_NoName2' (WIN_Form_EMailKonten.BTN_NoName2), line 29, thread 0
'EmailStartSMTPSession' function, syntax 7

Error code: 0
Level: non-fatal error (EL_ONRETURN)


Port 25 without emailOptionSecuredTLS:

---------------------------
E-Mail-Konten
---------------------------
SMTP WL call:
Process of 'Click BTN_NoName2' (WIN_Form_EMailKonten.BTN_NoName2), line 29, thread 0
'EmailStartSMTPSession' function, syntax 6

What happened?
The last response of SMTP server is:
<538 5.7.11 Authentifizierung nicht moeglich, bitte benutzen Sie eine Verbindung mit SSL/TLS Verschluesselung (siehe auch <a class="ExternalLink" rel="nofollow" target="_blank" href="http://strato-faq.de/artikel.html?id=171">http://strato-faq.de/artikel.html&hellip;</a>
>

Error code: 0
Level: non-fatal error (EL_ONRETURN)

Here is answer the E-Mail Server, the secure port is no used
Publicado el 02,diciembre 2014 - 00:40
Hi all,

I use this piece of code to send secure E-mails via Gmail with Windev 19

//Start a SMTP session EmailSetTimeOut(5) MySession is EmailSMTPSession MySession.Name = EmailSettings.EmailUser // = youremail@gmail.com MySession.Password = EmailSettings.EmailPassword // yourpassword MySession.ServerAddress = EmailSettings.EmailSmtpServer // smtp.gmail.com MySession.Port = EmailSettings.EmailSmtpPort // 587 IF EmailSettings.EmailSecure THEN MySession..Option = emailOptionSecuredTLS // If secure, and matching port END IF NOT EmailStartSession(MySession) THEN gclLogger.Add(ErrorInfo(),3) RETURN END //Reset the email variables to zero MyEmail is Email // Build E-mail Message MyEmail.Sender = EmailSettings.EmailFrom Add(MyEmail.Recipient, EmailSettings.EmailTo) //Subject and content of message IF bError THEN MyEmail.Subject = ApplicationName + " Error " + CTools::ToSQLDateTime(SysDateTime()) ELSE MyEmail.Subject = ApplicationName + " OK " + CTools::ToSQLDateTime(SysDateTime()) END MyEmail.Message = Location + CR + sMessage MyEmail.HTML = "" //Send the message EmailSendMessage(MySession,MyEmail) IF ErrorOccurred THEN Error(ErrorInfo(errSummary)) END //Close the SMTP session EmailCloseSession(MySession)

Hope this may help you !
Danny