Click to See Complete Forum and Search --> : sending mail in asp


rag84dec
04-03-2008, 05:03 AM
Hi ,
My simple code to send mail is this


<%
sch = "http://schemas.microsoft.com/cdo/configuration/"

Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ' cdoSendUsingPort
.Item(sch & "smtpserver") = "<enter_mail.server_here>"
.update
End With

Set cdoMessage = CreateObject("CDO.Message")

With cdoMessage
Set .Configuration = cdoConfig
.From = "rag84dec@gmail.com"
.To = "rag84dec@gmail.com"
.Subject = "Sample CDO Message"
.TextBody = "This is a test for CDO.message"
.Send
End With

Set cdoMessage = Nothing
Set cdoConfig = Nothing


%>



But it is giving me an error

Error Type:
CDO.Message.1 (0x80040213)
The transport failed to connect to the server.
/testmail.asp, line 21





Can any one help me please

yamaharuss
04-03-2008, 09:37 AM
Try this:

Set objCDOMail = Server.CreateObject("CDO.Message")
objCDOMail.To = "emailaddress"
objCDOMail.From = "emailaddrress"
objCDOMail.Subject = "subject here"
objCDOMail.HTMLBody = "message here"
objCDOMail.Send
Set objCDOMail = Nothing