|
DevMailerCOM Object Sample
DevMailer is a COM (Component Object Model) object
designed to send Email via SMTP from any COM / OLE / ActiveX enabled
application. More information can be found at http://www.geocel.com/devmailer
The following is a working sample of how this component
works on Active Server hosting accounts. There are literally thousands
of other combinations, colors, methods, etc that could be used to
accomplish the same function. Please note that we do not provide
support for this sample. It is only provided as a guide to help
you get started.
All the ASP code is documented. What is not documented is the plain
HTML tables which were added for aesthetic purposes.
You can download the file by clicking
here. Or try the sample by clicking
here.
This is what the ASP code looks like:
<%
' Check to see if the "EmailTo" field as filled out, if
it was, assume
' all other fields were filled out and try to send email
If Len(Request("EmailTo")) > 0 Then
' Create DevMailer Object
Set Mailer = CreateObject("Geocel.Mailer")
' Add first SMTP server
Mailer.AddServer "192.168.1.35",2525
' Set Sender Information
Mailer.FromAddress = Request("EmailFrom")
Mailer.FromName = Request("EmailFromName")
' Add a recipient to the message
Mailer.AddRecipient Request("EmailTo"),Request("EmailToName")
' Set the Subject and Body
Mailer.Subject = Request("Subject")
Mailer.Body = Request("Body")
' Send Email - Perform Error Checking
bSuccess = Mailer.Send()
If bSuccess = False Then
If Mailer.Queued = False Then
Response.Write
"Could not send message..queueing failed!"
Else
Response.Write
"Could not send message..queued instead!"
End If
Else
Response.Write "Message Sent
Successfully!"
End If
Else%>
<form name="form1">
<table>
<tr>
<td
colspan="2"><b>DevMailer Sample</b></td>
</tr>
<tr>
<td
valign="top">Email From:</td>
<td><input
type="text" name="EmailFrom"></td>
</tr>
<tr>
<td
valign="top">Email From Name:</td>
<td><input
type="text" name="EmailFromName"></td>
</tr>
<tr>
<td
valign="top">Email To:</td>
<td><input
type="text" name="EmailTo"></td>
</tr>
<tr>
<td
valign="top">Email To Name:</td>
<td><input
type="text" name="EmailToName"></td>
</tr>
<tr>
<td
valign="top">Subject:</td>
<td><input
type="text" name="Subject"></td>
</tr>
<tr>
<td
valign="top">Body:</td>
<td><textarea
cols="40" rows="10" name="Body"></textarea></td>
</tr>
<tr>
<td></td>
<td><input
type="submit" value="Send Email"></td>
</tr>
</table>
</form>
<%End If%>
And this is what it looks like in a web browser:
|