Hi, Sorry if this is the wrong forum.
I'm trying to send an email uding CDO. Can anyone please help?
form ---------------------
<form action="mail.asp" method="post" name="mailform">
<input name="email" type="text" size="40"/>
<input name="email_submit" type="submit"
value="sendmail"/>
</form>
code----------------------------
<%
dim oCdoMsg, oCdoConfg, strReferer, strServer, strClientIP, strServerIP, blnSpam
set oCdoMsg = server.createobject("CDO.Message")
strReferer = request.servervariables("HTTP_REFERER")
strServer = Replace(request.servervariables("SERVER_NAME"), "www.", "")
strClientIP = request.servervariables("REMOTE_ADDR")
strServerIP = request.servervariables("LOCAL_ADDR")
strFrom = "noreply@" & strServer
intComp = inStr(strReferer, strServer)
If intComp > 0 Then
blnSpam = False
Else
' Spam Attempt Block
blnSpam = True
End If
oCdoMsg.to = request.form("email")
oCdoMsg.from = strFrom
oCdoMsg.Subject = "CDO Test Mail"
oCdoMsg.Textbody = "This test mail has been sent from server "
oCdoMsg.Textbody = oCdoMsg.Textbody & request.servervariables("LOCAL_ADDR") & " via CDO mail objects."
strMSSchema = "http://schemas.microsoft.com/cdo/configuration/"
Set oCdoConfg = Server.CreateObject("CDO.Configuration")
oCdoConfg.Fields.Item(strMSSchema & "sendusing") = 2
oCdoConfg.Fields.Item(strMSSchema & "smtpserver") = "smtp.fasthosts.co.uk"
oCdoConfg.Fields.Update
Set oCdoMsg.Configuration = oCdoConfg
If NOT blnSpam Then
oCdoMsg.send
strResult = "Mail Sent."
Else
strResult = "Mail Not Sent."
End If
response.write strResult
set oCdoMsg = nothing
set oCdoConfg = nothing
%>
error:
error '8004020f'
/mail.asp, line 35