X-Send
Send e-mail fast and efficently with X-Send. X-Send uses
CDOSYS, which works with Windows Servers Software 2000 and
up. X-Send supports the sending of Plain text and HTML
e-mails, it also has built in support for SMTP server
authentication and easy configuration using the
Scripting.Dicionary object. X-Send also supports custom
error reporting and reports complete errors returned by
VBScript. We are currently working on adding some new and
exciting features to X-Send, some of the things we are
working on are:
-
Attachement Sending
-
Multipart Messages
-
Even more error reporting
-
Custom Headers
Installation
Requirements:
-
IIS 5.0 or higher
-
CDOSYS
-
ASP Enabled web server
You can easily install X-Send on your web server, it take
just a matter of seconds. Simply upload X-Send.asp to your
web server, and your done. Yes thats it, X-Send is now ready
to work for you.
Using X-Send in your code
There is one thing you will find tricky about using X-Send,
while you don't have to memorize CDO schema URLs or anything
like that X-Send can be tricky to implement into existing
code. If you are writing new code, however, you will find
X-Send much easier. First thing you need to do is add some
metadata to your global.asa or to X-Send.asp. This metadata
will vary as it depends on your web server's installed
components.Here are some examples:Windows
Server 2000 and Windows XP Professional
<!-- METADATA TYPE="TypeLib" NAME="Microsoft ActiveX
Data Objects 2.5 Library"
UUID="{00000205-0000-0010-8000-00AA006D2EA4}"
VERSION="2.53.6200.0" -->
<!-- METADATA TYPE="TypeLib" NAME="CDO for Windows 2000
Type Library" UUID="{CD000000-8B95-11D1-82DB-00C04FB1625D}"
VERSION="6.1.3940.33" -->
Windows Server
2003<!-- METADATA TYPE="TypeLib"
NAME="Microsoft ActiveX Data Objects 2.8 Library"
UUID="{2A75196C-D9EB-4129-B803-931327F72D5C}"
VERSION="2.80.1022.0" -->
<!-- METADATA TYPE="TypeLib" NAME="CDO for Windows 2000
Type Library" UUID="{CD000000-8B95-11D1-82DB-00C04FB1625D}"
VERSION="6.5.6747.0" -->
You might have to do some experimenting with TypeLib if
X-Send doesn't work. Some Microsoft service packs or
updates will cause varations from this help file.
Configuring X-Send
There are 15 properties that allow you to configure X-Send.
See below for details
SendUsing: cdoSendUsingPickup or cdoSendUsingPort
SMTPServer: SMTP server address if SendUsing = cdoSendUsingPort
SMTPServerPort: SMTP server port if SendUsing = cdoSendUsingPort
SMTPAuthenticate: True to Authenticate on SMTP Server, False to Authenticate Anonymous
SMTPUserName: Username to Authenticate as
SMTPPassWord: Password to Authenticate with
SMTPServerPickUpDirectory: Path to PickUp direcory if SendUsing = cdoSendUsingPickup
Importance: cdoLow, cdoNormal, or cdoHigh
ToName: First and Last Name of addressee
ToEMail: E-Mail Address of addressee
FromName: Site Name or First and Last Name of sender
FromEMail: Site E-Mail or Sender E-Mail
Subject: Message Subject
HTMLBody: True for HTML Messages, False for Plain Text Messages
Message: HTML or Plain Text message
Error Reporting
X-Send function returns a collection of information
containing error codes if any errors were encountered.
While this feature is still very much in development, it
also supports custom errors. You can obtain this collection
using the dictionary object, this will be further explained
in the next section, along with some other examples. See
below for what is returned in the collection:
MessageSent: True or False, Indicates if error was encountered while sending message
ErrorMessage: Reserved for future development
ErrorNumber: Reports VBScript Err.Number
ErrorDescription: Reports VBScript Err.Description
ErrorSource: Reports VBScript Err.Source
Error reporting will not report a problem between SMTP
servers, as once the page is executed and a report is made
the message is no longer tracked. This also means that your
custom error could report a message as sent, but the
addressee could never get the message. This has nothing to do
with X-Send, but more to do with SMTP servers you are using.
Code Examples
To aid you in development here are some examples on how to
use X-Send.
Send an email via SMTP Authentication
<%
Dim objEMailParms, objEMailResponse, blnMessageSent
Set objEMailParms = Server.CreateObject("Scripting.Dictionary")
objEMailParms.Add "SendUsing", cdoSendUsingPort
objEMailParms.Add "SMTPServer", "localhost"
objEMailParms.Add "SMTPServerPort", 25
objEMailParms.Add "SMTPAuthenticate", True
objEMailParms.Add "SMTPUserName", "username@yourdomain.com"
objEMailParms.Add "SMTPPassWord", "asdas"
objEMailParms.Add "Importance", cdoNormal
objEMailParms.Add "ToName", "John Doe"
objEMailParms.Add "ToEMail", "jdoe@yourdomain.com"
objEMailParms.Add "FromName", "Your Site OR Your Name"
objEMailParms.Add "FromEMail", "webmaster@yoursite.com"
objEMailParms.Add "Subject", "Your Subject goes here"
objEMailParms.Add "HTMLBody", False
objEMailParms.Add "Message", "Your Message goes here!"
Set objEMailResponse = SendMail(objEMailParms)
objEMailParms.RemoveAll()
Set objEMailParms = Nothing
blnMessageSent = objEMailResponse.Item("MessageSent")
objEMailResponse.RemoveAll()
Set objEMailResponse = Nothing
If blnMessageSent = True Then
Response.Write("Message was sent!")
Else
Response.Write("Message failed!")
End If
%>
Send an email without SMTP Authentication
<%
Dim objEMailParms, objEMailResponse, blnMessageSent
Set objEMailParms = Server.CreateObject("Scripting.Dictionary")
objEMailParms.Add "SendUsing", cdoSendUsingPort
objEMailParms.Add "SMTPServer", "localhost"
objEMailParms.Add "SMTPServerPort", 25
objEMailParms.Add "SMTPAuthenticate", False
objEMailParms.Add "Importance", cdoNormal
objEMailParms.Add "ToName", "John Doe"
objEMailParms.Add "ToEMail", "jdoe@yourdomain.com"
objEMailParms.Add "FromName", "Your Site OR Your Name"
objEMailParms.Add "FromEMail", "webmaster@yoursite.com"
objEMailParms.Add "Subject", "Your Subject goes here"
objEMailParms.Add "HTMLBody", False
objEMailParms.Add "Message", "Your Message goes here!"
Set objEMailResponse = SendMail(objEMailParms)
objEMailParms.RemoveAll()
Set objEMailParms = Nothing
blnMessageSent = objEMailResponse.Item("MessageSent")
objEMailResponse.RemoveAll()
Set objEMailResponse = Nothing
If blnMessageSent = True Then
Response.Write("Message was sent!")
Else
Response.Write("Message failed!")
End If
%>
Send an HTML e-mail
<%
Dim objEMailParms, objEMailResponse, blnMessageSent
Set objEMailParms = Server.CreateObject("Scripting.Dictionary")
objEMailParms.Add "SendUsing", cdoSendUsingPort
objEMailParms.Add "SMTPServer", "localhost"
objEMailParms.Add "SMTPServerPort", 25
objEMailParms.Add "SMTPAuthenticate", False
objEMailParms.Add "Importance", cdoNormal
objEMailParms.Add "ToName", "John Doe"
objEMailParms.Add "ToEMail", "jdoe@yourdomain.com"
objEMailParms.Add "FromName", "Your Site OR Your Name"
objEMailParms.Add "FromEMail", "webmaster@yoursite.com"
objEMailParms.Add "Subject", "Your Subject goes here"
objEMailParms.Add "HTMLBody", True
objEMailParms.Add "Message", "Your Message goes here!"
Set objEMailResponse = SendMail(objEMailParms)
objEMailParms.RemoveAll()
Set objEMailParms = Nothing
blnMessageSent = objEMailResponse.Item("MessageSent")
objEMailResponse.RemoveAll()
Set objEMailResponse = Nothing
If blnMessageSent = True Then
Response.Write("Message was sent!")
Else
Response.Write("Message failed!")
End If
%>
Copyright © 2004 - 2005 FreedomWeb.US Enterprises. All Rights Reserved.