Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Classic ASP Send Email

Posted on March 3, 2014May 25, 2017 By David Kittell
<%
Set myMail=CreateObject("CDO.Message")

if Request("subject") <> "" then
	myMail.Subject=Request("subject")
else
	myMail.Subject="<Subject>"
end if

if Request("from") <> "" then
	myMail.From=Request("from")
else
	myMail.From="<From Email Address>"
end if

if Request("To") <> "" then
	myMail.To=Request("To")
else
	myMail.To="<To Email Address>"
end if

if Request("Cc") <> "" then
	myMail.CC=Request("Cc")
else
	myMail.CC="<CC Email Address>"
end if

myMail.TextBody= request("body")
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'SMTP server
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="<SMTP Server>"
'SMTP port
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update

On Error Resume Next
myMail.Send
If Err <> 0 Then
	Response.Write "An error occurred: " & Err.Description
else
	Response.Write("<b>")
	Response.Write("Email sent to " & request("to") & " from " & request("from"))
	Response.Write("<br><br>")
End If

set myMail=nothing
%>
Originally Posted on March 3, 2014
Last Updated on May 25, 2017
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

ASP Code VB

Post navigation

Previous post
Next post

Related Posts

C# GetData DataSet Function

Posted on May 21, 2015October 26, 2015

Great for populating just about anything you can databind. using System.Configuration; using System.Data.SqlClient; using System.Data; private DataSet GetData(string query) { SqlCommand cmd = new SqlCommand(query); using (SqlConnection con = new SqlConnection(connString)) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataSet ds = new…

Read More

Remove Directory

Posted on October 12, 2015October 12, 2015

rd c:\temp\directorytoremove Now if this first command doesn’t work make sure it’s a directory you want to delete and try this next one rd /s c:\temp\directorytoremove All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development)…

Read More

PowerShell Set DNS Settings

Posted on September 24, 2015October 16, 2015

This only works on Windows 8, 8.1, 10 as the Cmdlets Set-DnsClientServerAddress Get-DnsClientServerAddress are introduced in Windows 8. First get the interface name(s) you want to modify Get-DnsClientServerAddress Change the code below to the interface you wish to change $primarydns = $args[0] $secondarydns = $args[1] Set-DNSClientServerAddress –interfaceAlias Wi-Fi –ServerAddresses ($primarydns,$secondarydns)…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes