Simple Classic ASP Send Email Subroutine

Discussion in 'ASP Snips' started by AltonConsulting, Feb 20, 2007.

  1. '============================================================================
    ' sendEmail Subroutine by Dan Robertson ([email protected])
    Sub sendEmail(mailFrom, mailTo, mailSubject, mailMessage, mailServer, mailUsername, mailPassword)
    Set MyMail = CreateObject("cdo.message")
    MyMail.From = mailFrom
    MyMail.To = mailTo
    MyMail.Subject = mailSubject
    MyMail.HTMLBody = mailMessage
    MyMail.Configuration.Fields.Item("") = 2
    MyMail.Configuration.Fields.Item("") = mailServer
    MyMail.Configuration.Fields.Item("") = mailUsername
    MyMail.Configuration.Fields.Item("") = mailPassword
    MyMail.Configuration.Fields.Item("") = 1
    MyMail.Configuration.Fields.Item("") = 25
    Set MyMail = nothing
    End Sub

    Dim mailFrom, mailTo, mailSubject, mailMessage, mailServer, mailUsername, mailPassword

    mailFrom = "[email protected]"
    mailTo = "[email protected]"
    mailSubject = "This is my subject"
    mailMessage = "<html><body>This is my message</body><html>"
    mailServer = ""
    mailUsername = "myUsername"
    mailPassword = "myPassword"

    Call sendEmail(mailFrom, mailTo, mailSubject, mailMessage, mailServer, mailUsername, mailPassword)
  2. I have noticed a lot of views on this post, but disappointingly no one has commented (given feedback) or even more important, contributed any other code blocks, tips, or advice on "classic" ASP. I would like to see this forum grow and become a great resource for classic ASP developers and future ASP developers.

    I know there is a big buzz around the whole ASP.NET realm, but unless creating large, application oriented internet projects, classic ASP is perfect for accomplishing whatever needed on most sites (other than heavy application based "Dot-Com" sites), and makes a web developer's life much easier.

    I am also going to go as far as to say ASP is far superior to PHP (which in my opinion is a pain in the a$$).

    Tell me what you think...
  3. KCWebMonkey

    KCWebMonkey Perch

    i'll bet the high view count is because people are coming in from Google and viewing the post... probably copying it and leaving.
  4. Stephen

    Stephen US Operations Staff Member

    yes, its highly 'googled' around here!
  5. BluJag

    BluJag Perch

    I agree asp v php, but probably because I'm not very familiar with php. As to .net, I think it's the only way to go, forget classic asp. MS have made it very easy (with Web Developer Express as a free download) and JoDo host .net 2 along with, so what more could you want ? Why bother with classic asp and it's associated spaghetti code and lack of proper types etc?
  6. KenPalmer

    KenPalmer Guppy

    Thanks Dan. You saved my bacon! Your code worked like a champ virtually unedited.

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services