I have never had such a hard time finding the correct way to create an online form that email the contents. Apparently there are several way to do email, but at least on the server that I have access to non of them work. Apparently there was/is a old way of doing email objects with CDONTS, however Microsoft has replaced that with CDOSYS, sadly most of the guides online to doing email forms with asp use the older CDONTS way, which on the server I have access to does absolutely nothing...
SO after looking through many guides I finally found a correct (in the fact that it works) way of doing ASP based email.
Set oCdoMail = Server.CreateObject("CDO.Message")
Set oCdoConf = Server.CreateObject("CDO.Configuration")
sConfURL = "http://schemas.microsoft.com/cdo/configuration/"
with oCdoConf
.Fields.Item(sConfURL & "sendusing") = 2
.Fields.Item(sConfURL & "smtpserver") = "localhost"
.Fields.Item(sConfURL & "smtpserverport") = 25
.Fields.Update
end with
with oCdoMail
.From = "your server"
.To = "email to send to"
.Subject = "Subject line"
.HTMLBody = "Body of email"
.Configuration = oCdoConf
.Send
end with
Set oCdoConf = Nothing
Set oCdoMail = Nothing
I do warn you that this works for me, and should... (and I take should lightly) work for you, however I feel that it is worth warning on that fact that depending on how your server is set up, who knows how ASP will function.
No comments:
Post a Comment