Search Our Database

How to send mail using ASP?

Last updated on |

To send a message from your domain via ASP, here is a sample code. Assume that:

Domain name:
Mail server Host-name:
E-mail account:
password: pass4567

Dim objMessage

Set objMessage = Server.CreateObject("CDO.Message")

With objMessage.Configuration.Fields
  'Send the message using the network (SMTP over the network).
  .Item("") = 2
     = ""
  .Item("") = 2525
  'Use SSL for the connection (True or False)
  .Item("") = False
  .Item("") = 60

  'Type of authentication, NONE, Basic (Base64 encoded), NTLM
  .Item("") = 1
     = ""
  .Item("") = "pass4567"
End With

With objMessage
  .To = "Recipient Name "
  .From = "Sender Name"
  .Subject = "This is the mail subject"
  .TextBody = "This is the mail message."
End With

Set objMessage = Nothing

Response.Write "Message sent!"