Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
18
Erster Beitrag:
vor 3 Jahren, 6 Monaten
Letzter Beitrag:
vor 3 Jahren, 6 Monaten
Beteiligte Autoren:
Netapp, MAURIZIO MARTINEZ BAZAN, Fabrice Harari, Alexandre Leclerc, Danny Lauwers, Paulo Oliveira, Maurizio Martinez, Paul Turner, Peter Holemans

WD18 E-mails via a secure connection

Startbeitrag von Netapp am 29.11.2014 19:18

Hi Everybody,

how can I send E-mail with a secure Connection (http://www.strato-faq.co.uk/article/118/Can-I-send-my-e-mails-via-a-secure-connection-(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:.

Antworten:

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

von Fabrice Harari - am 29.11.2014 20:26
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?)

von Netapp - am 29.11.2014 22:19
"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.:-(

von Netapp - am 29.11.2014 22:41
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

von Fabrice Harari - am 30.11.2014 12:20
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.

von Netapp - am 30.11.2014 15:08
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

von MAURIZIO MARTINEZ BAZAN - am 30.11.2014 15:42
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.

von Netapp - am 30.11.2014 16:02
Yes, also I think that for PCSOFT the beautiful women are more important. I have tried with other tools as febootmail or blat to include in my windev program, but there are problems with ssl connect and they don't work. Perhaps this implementation is difficult. For my programs, all smtp server are named as smtps.xxxxxxx.xx and port is 465.
Maurizio

von MAURIZIO MARTINEZ BAZAN - am 30.11.2014 18:51
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

von Paul Turner - am 30.11.2014 23:54
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

von Maurizio Martinez - am 01.12.2014 07:01
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.

von Peter Holemans - am 01.12.2014 08:38
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")

von Paulo Oliveira - am 01.12.2014 10:08
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

von Alexandre Leclerc - am 01.12.2014 13:34
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

von Netapp - am 01.12.2014 17:07
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:


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


von Netapp - am 01.12.2014 17: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)

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:


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

Here is answer the E-Mail Server, the secure port is no used


von Netapp - am 01.12.2014 17:38
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

von Danny Lauwers - am 01.12.2014 23:40
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.