ASPnetEmail
By Scott Forsyth
September 20, 2002
ASPnetEmail is a SMTP email component designed specifically for
performance, features and .NET. It boasts many feature and performance benefits
over System.Web.Mail and delivers on it. If you are looking for a component for
high volume mail merges or newsletters, consider your search ended.
Some features not seen in many other mail components include: logging,
custom length word wrap, HTML and plain text support, Ignore Recipient Errors (this
in itself is a feature of beauty) and many more.
What it has that really sets it
apart is the mailmerge from the DataReader functionality. Powerful mailmerges can
be done with minimal coding. Check out their examples
http://www.aspnetemail.com/Examples.aspx
to see this in action.
My only caution is for those who aren't using Visual Studio.NET
and rely on their own examples. They will find that getting a simple example working
isn't just a matter of cut-and-pasting from their examples. For that reason, I've
included a basic example to get you started in the right direction. The following
code can be cut-and-pasted into a .aspx page to give the same functionality as the
example at the bottom of this page.
Creating an application using ASPnetEmail requires the following:
- copy the aspnetemail.dll to your /bin folder
- create a page like the one below using asp.net and name it
with .aspx as the extension
- test!! I only put this line here because it seemed too simple
having only 2 points. It's that easy, really.
|
<%@ Page Language="VB" %>
<script runat="server">
Sub cmdSubmit_Click(sender As Object, e As EventArgs)
'reference the component, located in /bin
Dim msg As New aspNetEmail.EmailMessage()
'add the properties to the component
msg.FromName = txtFromName.Text
msg.FromAddress = txtFromEmail.Text
msg.To = txtToEmail.Text
msg.Server = txtSMTPServer.Text
msg.Subject = txtSubject.Text
msg.Body = txtBody.Text
msg.ThrowException = False
'send it now
If msg.Send() Then
Response.Write("<font color=""red"">Message Sent!</font>")
Else
Response.Write(msg.LastException().Message)
End If
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<table border="0">
<tbody>
<tr>
<td><font face="Verdana">From Name</font></td>
<td><asp:TextBox id="txtFromName" runat="server" Width="204px"></asp:TextBox>
<font face="Arial"></font></td>
</tr>
<tr>
<td><font face="Arial">From Email</font></td>
<td><asp:TextBox id="txtFromEmail" runat="server" Width="204px"></asp:TextBox>
<font face="Arial"></font></td>
</tr>
<tr>
<td><font face="Arial">To</font></td>
<td><asp:TextBox id="txtToEmail" runat="server" Width="204px"></asp:TextBox>
<font face="Arial"></font></td>
</tr>
<tr>
<td><font face="Arial">Subject</font></td>
<td><asp:TextBox id="txtSubject" runat="server" Width="204px"></asp:TextBox>
<font face="Arial"></font></td>
</tr>
<tr>
<td><font face="Arial">SMTP Server</font></td>
<td><asp:TextBox id="txtSMTPServer" runat="server" Width="204px"></asp:TextBox>
<font face="Arial"></font></td>
</tr>
<tr>
<td><font face="Arial">Body</font></td>
<td><font face="Arial"> </font></td>
</tr>
</tbody>
</table>
<p>
<font face="Arial"> </font>
<asp:TextBox id="txtBody" runat="server" Width="520px" Height="286px" TextMode="MultiLine"></asp:TextBox>
<font face="Arial"></font>
</p>
<p>
<asp:Button id="cmdSubmit" onclick="cmdSubmit_Click" runat="server" Text="Send"></asp:Button>
</p>
</form>
</body>
</html>
|
Links:
Scott Forsyth is a senior web specialist at
ORCS Web, Inc.
- a company that provides managed hosting solutions for clients who develop and deploy their applications on Microsoft Windows platforms. Services include shared hosting, dedicated hosting, and webfarm hosting, with specialty in .Net, SQL Server, and architecting highly scalable solutions.