I've been trying countless hours to get email from my asp.net form. Tech support offered no help.
I've set up a subdomain for a site I am building, the email account is under the main domain. I have yet to get this to connect to the server. Here's the code I've been using.
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Dim strBody
Dim strSmartHost
Const cdoSendUsingPort = 465
strSmartHost = "mail.maindomain.us"
iMsg = CreateObject("CDO.Message")
iConf = CreateObject("CDO.Configuration")
Flds = iConf.Fields
With Flds
.Item("
http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("
http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Item("
http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Item("
http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
.Item("
http://schemas.microsoft.com/cdo/configuration/sendusername", "emailaccount@domain")
.Item("
http://schemas.microsoft.com/cdo/configuration/sendpassword", "password")
.Update()
End With
strBody = "This is a test of sending an email via ASP" & vbCrLf & vbCrLf
strBody = strBody & "This is line 2. " & vbCrLf
strBody = strBody & "you can have as many as you want" & vbCrLf
strBody = strBody & "THIS IS AN AUTOMATED EMAIL - PLEASE DO NOT REPLY"
' apply the settings to the message
With iMsg
.Configuration = iConf
.To = "externalemailacct"
.From = "emailaccount"
.Subject = "This is a test message from an ASP Email"
.textbody = strBody
'redirect code goes here
.Send(iMsg)
End With
' cleanup of variables
iMsg = Nothing
iConf = Nothing
Flds = Nothing
I've tried using different ports, encoded and unecoded username and password.
If I don't get this to work soon, I will have to try another hosting company.
biffwa57