Classic ASP
How can I send email from ASP page?
To send email from ASP pages please use following code:
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "mailid@yourdomain.com"
objEmail.To = "maild@somedomain.com"
objEmail.Subject = "the subject"
// Here your HTML Formatted content//
objEmail.HTMLBody = HTML
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.yourdomain.com"
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = "1"
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "mailid@yourdomainn.com"
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "yourmailpassword"
objEmail.Configuration.Fields.Update
objEmail.Send
If Not err.number=0 Then
Response.write "ERROR: " & err.Description
err.Clear
end if
Response.Redirect("sent.asp")