-
May 7th, 2019, 07:01 AM
#1
Thread Starter
New Member
[RESOLVED] Email setup (SMTP, port, SSL, etc) - did it change in Windows 10
My application which has SMTP email abilities has stopped working since the advent of W10. Does anyone know if something has changed? Worked on every other platform.
Current app asks user for:
- SMTP server
- server port
- whether to use SSL or not (with warning if turned off - "most email servers use SSL...")
- checkbox for Server authentication required
- User ID (email address)
- display name
- email PW
Code for the "Send test email" as follows:
Code:
On Error GoTo hell
temp = formEmailSetup.MousePointer
formEmailSetup.MousePointer = vbHourglass
'check validity of info
If txtServer = "smtp.example.com" Or txtUserName = "example@example.com" Or txtDisplayName = "Your Name Here" Then
MsgBox "Enter your information into all boxes."
Exit Sub
End If
If VBA.Trim(txtServer) = "" Or VBA.Trim(txtUserName) = "" Or txtDisplayName = "" Or txtPort = "" Then
MsgBox "All boxes must have a value."
Exit Sub
End If
'setup for email
Set objemail = CreateObject("CDO.Message")
objemail.From = txtDisplayName & "<" & txtUserName & ">"
objemail.To = txtUserName
objemail.Subject = "Test mail"
objemail.TextBody = "Your ability to EMail customers is ready to go!" & vbNewLine & emailSig & vbNewLine & vbNewLine & "------------------------------------" & vbNewLine & "This message was generated automatically from XXX"
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = txtServer
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
If chkAuthentication.Value = 1 Then
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
Else
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous
End If
'Your UserID on the SMTP server
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = txtUserName
'Your password on the SMTP server
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = txtPassword
'Server port (typically 25)
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = txtPort
'Use SSL for the connection (False or True)
If chkSSL.Value = 1 Then
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
Else
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
End If
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objemail.Configuration.Fields.update
'==End remote SMTP server configuration section==
objemail.Send
formEmailSetup.MousePointer = temp
If licensed = "yes" Then
MsgBox "Mail successfully sent to: " & txtUserName
Else
MsgBox "Mail successfully sent to: " & txtUserName
End If
Exit Sub
hell:
formEmailSetup.MousePointer = temp
If Err.Number = -2147220973 Then
MsgBox "The server could not make the connection to your email account. Please check the information and try again"
ElseIf Err.Number = -2147220978 Then
MsgBox "The Email server has responded with an error: " & Err.Description & "Your message will not be sent, and your email is not properly set up. Please contact your email provider for assistance."
Else
MsgBox "An internal error has occured. Code:4003-" & Err.Number & " " & Err.Description
End If
Error code being returned is -2147220973
thoughts?
Last edited by vbr1; May 7th, 2019 at 07:11 AM.
-
May 7th, 2019, 07:50 AM
#2
Hyperactive Member
Re: Email setup (SMTP, port, SSL, etc) - did it change in Windows 10
Have you walked through the code to see what line it's failing at?
I'm not familiar with the "CDO.Message" object. I use a third party component called wodSMTP from "We Only Do" software and it's working properly for me on Win10.
-
May 7th, 2019, 08:01 AM
#3
Re: Email setup (SMTP, port, SSL, etc) - did it change in Windows 10
...and i'm pretty sure, that accompanying the Error-Code was a Description.....
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
May 7th, 2019, 08:29 AM
#4
Hyperactive Member
Re: Email setup (SMTP, port, SSL, etc) - did it change in Windows 10
I've never seen the CDO library give a more descriptive error message when it comes back with that number.
That code works fine for me in the latest Windows 10. Test a simple connection to that server and port using telnet - it sounds like a routing or firewall problem.
-
May 7th, 2019, 08:34 AM
#5
Re: Email setup (SMTP, port, SSL, etc) - did it change in Windows 10
Last time I checked, CDO was still working on Windows 10 just like anywhere else. That was just a couple of months ago on Windows 10 1809. You can't just say "Windows 10" because it has undergone a steady evolution over the four years since it first came out.
Error 0x80040213 has the description: "The transport failed to connect to the server."
I suspect you have something else going on, like a firewall blocking traffic or the server's required connection configuration has changed.
-
May 7th, 2019, 04:29 PM
#6
Re: Email setup (SMTP, port, SSL, etc) - did it change in Windows 10
did you try changing authenticate to 3?
also make sure objemail.from has a value when the error occurs
i have just been getting cdo to work on a new download and install of w10, the previous used mostly default settings which did not apply in w10, but other than that it works fine
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
May 8th, 2019, 08:12 PM
#7
Thread Starter
New Member
Re: Email setup (SMTP, port, SSL, etc) - did it change in Windows 10
Originally Posted by westconn1
did you try changing authenticate to 3?
also make sure objemail.from has a value when the error occurs
i have just been getting cdo to work on a new download and install of w10, the previous used mostly default settings which did not apply in w10, but other than that it works fine
When I change the authentication line to
Code:
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 3
I get the following (different) error: "3749 Fields update failed. For further information, examine the Status property of individual field objects."
Since this morning, I added to the error msg line "& Err.description and now a more full picture appears:
"The transport failed to connect to the server"
This does sound like a firewall issue. I am getting it on two W10 machines though. W10 v1803 on one and v1809 on another
-
May 9th, 2019, 07:50 AM
#8
Re: Email setup (SMTP, port, SSL, etc) - did it change in Windows 10
When I change the authentication line to
sendusing must be 2
3 would give an invalid field hence the error
Code:
If chkAuthentication.Value = 1 Then
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
Else
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous
End If
try cdoNTLM (=2) or 3 (not sure of the constant), but that was what i was using, to see if it helps
i had no issue with the default firewall setup, i doubt port 25 would be blocked and i had no issue with the special port that my emails go out on, if the emails from windows 10 are going through the same outgoing server i do not think there should be any problem
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
May 15th, 2019, 07:28 AM
#9
Thread Starter
New Member
Re: Email setup (SMTP, port, SSL, etc) - did it change in Windows 10
Originally Posted by westconn1
sendusing must be 2
3 would give an invalid field hence the error
Code:
If chkAuthentication.Value = 1 Then
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
Else
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous
End If
try cdoNTLM (=2) or 3 (not sure of the constant), but that was what i was using, to see if it helps
i had no issue with the default firewall setup, i doubt port 25 would be blocked and i had no issue with the special port that my emails go out on, if the emails from windows 10 are going through the same outgoing server i do not think there should be any problem
In terms of the actual code, where/what/how would the cdoNTLM = 2 be set? Sorry. Appreciate the help, but I am confused about your comment and how it folds in.
I will be honest here, I grabbed most of this code from this forum about 5+ years ago and dont really know how it works. Obviously i can see and understand what is being done in the code (logically) but i dont know the process well enough to insert it into this shared code.
TIA for the answer(S)
-
May 15th, 2019, 07:39 AM
#10
Thread Starter
New Member
Re: Email setup (SMTP, port, SSL, etc) - did it change in Windows 10
Originally Posted by westconn1
sendusing must be 2
3 would give an invalid field hence the error
Code:
If chkAuthentication.Value = 1 Then
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
Else
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous
End If
try cdoNTLM (=2) or 3 (not sure of the constant), but that was what i was using, to see if it helps
i had no issue with the default firewall setup, i doubt port 25 would be blocked and i had no issue with the special port that my emails go out on, if the emails from windows 10 are going through the same outgoing server i do not think there should be any problem
In terms of the actual code, where/what/how would the cdoNTLM = 2 be set? Sorry. Appreciate the help, but I am confused about your comment and how it folds in.
I will be honest here, I grabbed most of this code from this forum about 5+ years ago and dont really know how it works. Obviously i can see and understand what is being done in the code (logically) but i dont know the process well enough to insert it into this shared code.
TIA for the answer(S)
-
May 15th, 2019, 04:38 PM
#11
Re: Email setup (SMTP, port, SSL, etc) - did it change in Windows 10
In terms of the actual code, where/what/how would the cdoNTLM = 2 be set?
in place of cdobasic or cdoanonymous, you could replace the quoted code above with
Code:
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoNTLM
my current code (which works in windows 10) specifies smtpauthenticate = 3, but i do not know what the constant for that is
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
May 31st, 2019, 03:24 PM
#12
Thread Starter
New Member
Re: Email setup (SMTP, port, SSL, etc) - did it change in Windows 10
It appears that the line
Code:
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 3
fixes the problem, rather than
Code:
objemail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
Thanks everyone, especially westconn1
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|