Taking from everyone else's code, here's a full script. Note that you'd have to modify the SendHtmlEmail function to work with whatever email component your host has (just like the existing SendMail function).
<%@ LANGUAGE="VBScript" %>
<!-- #include file="includes/config.asp" --><!-- #include file="includes/common.asp" --><% PageSubTitle = "Email All Users" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<% 'Limit access to the Administrator.
call CheckAccess(true) %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title><% = PAGE_TITLE & ": " & PageSubTitle %></title>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="styles/common.css" />
<link rel="stylesheet" type="text/css" href="styles/print.css" media="print" />
<script type="text/javascript" src="scripts/scriptLib.js"></script>
<script type="text/javascript" src="scripts/common.js"></script>
<script type="text/javascript" src="scripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">//<![CDATA[
//=========================================================================
// Create the TinyMCE control to be used for editing the email.
//=========================================================================
tinyMCE.init({
content_css : "styles/common.css",
editor_selector : "mceEditor",
font_size_style_values : "xx-small,x-small,small,medium,large,x-large,xx-large",
mode : "textareas",
plugins : "advimage,advlink,emotions,fullscreen,iespell,inlinepopups,layer,media,preview,safari,searchreplace,style,table,xhtmlxtras",
theme : "advanced",
theme_advanced_buttons1 : "formatselect,fontselect,fontsizeselect,|,forecolor,backcolor,|,bold,italic,underline,strikethrough",
theme_advanced_buttons2 : "justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,outdent,indent,blockquote,|,link,unlink,anchor,image,hr,|,charmap,emotions,media",
theme_advanced_buttons3 : "insertlayer,moveforward,movebackward,absolute,|,tablecontrols,|,visualaid",
theme_advanced_buttons4 : "styleprops,|,cite,abbr,acronym,del,ins,attribs,|,search,replace,|,undo,redo,|,removeformat,cleanup,code,iespell,|,fullscreen,preview,|,help",
theme_advanced_font_sizes : "xx-small,x-small,small,medium,large,x-large,xx-large",
theme_advanced_toolbar_location : "bottom",
theme_advanced_toolbar_align : "center",
theme_advanced_path : false,
theme_advanced_resizing : false
});
//]]></script>
</head>
<body>
<!-- #include file="includes/header.asp" -->
<!-- #include file="includes/siteMenu.asp" -->
<div id="contentSection">
<!-- #include file="includes/email.asp" -->
<!-- #include file="includes/encryption.asp" -->
<!-- #include file="includes/form.asp" -->
<table id="mainWrapper" border="0" cellpadding="0" cellspacing="0"><tr><td>
<% 'Open the database.
call OpenDB()
'If an send was requested, process it.
dim sql, rs
dim subj, msg, email
dim str, errorMsg
if Request.Form("submit") = "Send" then
subj = Request.Form("subject")
msg = Request.Form("body")
sql = "SELECT EmailAddress FROM Users"
set rs = DbConn.Execute(sql)
do while not rs.EOF
email = Decrypt(rs.Fields("EmailAddress").Value)
if email <> "" then
errorMsg = SendHtmlEmail(email, subj, msg)
if errorMsg <> "" then
call DisplayErrorMessage("Email send failed: " & errorMsg)
exit do
end if
end if
rs.MoveNext
loop
if errorMsg = "" then
call DisplaySuccessMessage("Emails sent.")
end if
end if
'Display the form.
dim subjectText, bodyText
if Request.ServerVariables("Content_Length") > 0 and not IsCancelRequest() then
subjectText = Request.Form("subject")
bodyText = Request.Form("body")
end if %>
<form action="<% = Request.ServerVariables("SCRIPT_NAME") %>" method="post">
<table class="main fixed" border="0" cellpadding="0" cellspacing="0">
<tr class="header bottomEdge">
<th align="left">Send Email to All Users</th>
</tr>
<tr>
<td class="freeForm">
<p><strong>Subject:</strong> <input type="text" name="subject" value="<% = subjectText %>" size="50" /></p>
<table class="htmlEditorArea" border="0" cellpadding="0" cellspacing="0"><tr><td style="padding: 0px;">
<div style="margin: 0px;">
<textarea name="body" class="mceEditor" rows="30" cols="80" style="width: 39em;"><% = bodyText %></textarea>
</div>
</td></tr></table>
</td>
</tr>
</table>
<p><input type="submit" name="submit" value="Send" class="button" /> <input type="submit" name="submit" value="Cancel" class="button" /></p>
</form>
</td></tr></table>
</div>
<!-- #include file="includes/footer.asp" -->
</body>
</html>
<% '**************************************************************************
'* Local functions and subroutines. *
'**************************************************************************
'--------------------------------------------------------------------------
' Sends an email in HTML format and returns an empty string if successful.
' Otherwise, it returns the error message.
'--------------------------------------------------------------------------
function SendHtmlEmail(toAddr, subjectText, htmlBody)
dim mailer
dim cdoMessage, cdoConfig
'Assume all will go well.
SendHtmlEmail = ""
'Configure the message.
set cdoMessage = Server.CreateObject("CDO.Message")
set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.example.net"
cdoConfig.Fields.Update
set cdoMessage.Configuration = cdoConfig
'Create the email.
cdoMessage.From = ADMIN_USERNAME & " <" & ADMIN_EMAIL & ">"
cdoMessage.To = toAddr
cdoMessage.Subject = subjectText
cdoMessage.HTMLBody = htmlBody
'Send it.
on error resume next
cdoMessage.Send
'If an error occurred, return the error description.
if Err.Number <> 0 then
SendHtmlEmail = Err.Description
end if
'Clean up.
set cdoMessage = Nothing
set cdoConfig = Nothing
end function %>