MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.
Sub TestEmailSettings2(smtp_username,smtp_password,mail_server) On Error Resume Next Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing" Const cdoSendUsingPort = 2 Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver" Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport" Const cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout" Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" Const cdoBasic = 1 Const cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername" Const cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword" Dim objConfig ' As CDO.Configuration Dim objMessage ' As CDO.Message Dim Fields ' As ADODB.Fields Set objConfig = Server.CreateObject("CDO.Configuration") Set Fields = objConfig.Fields With Fields .Item(cdoSendUsingMethod) = cdoSendUsingPort .Item(cdoSMTPServer) = smtp_mail_server .Item(cdoSMTPServerPort) = 25 .Item(cdoSMTPConnectionTimeout) = 10 .Item(cdoSMTPAuthenticate) = cdoBasic .Item(cdoSendUserName) = smtp_username .Item(cdoSendPassword) = smtp_password .Update End With Set objMessage = Server.CreateObject("CDO.Message") Set objMessage.Configuration = objConfig With objMessage .To = "email@example.com" .From = smtp_username & "<" & smtp_username & ">" .Subject = "Test Message: " & smtp_username .TextBody = "This is a test message to see if your email settings were configured properly" .Send End With Set Fields = Nothing Set objMessage = Nothing Set objConfig = Nothing If Err.Number <> 0 Then Call ClearSMTPEmailSettings(djidnumber) Call DisplayError("We were able to connect to the mail server. However, there appears to be a setting on your server that is preventing the proper relaying of messages. Please recheck the settings and try again or leave the settings blank.") End If End Sub