Skip to content

Instantly share code, notes, and snippets.

@jlbruno
Last active August 29, 2015 14:13
Show Gist options
  • Save jlbruno/e4a2e72240d4fdec460f to your computer and use it in GitHub Desktop.
Save jlbruno/e4a2e72240d4fdec460f to your computer and use it in GitHub Desktop.
Local mailer
<HTML>
<HEAD>
</HEAD>
<BODY>
<% if request.querystring("post") <> "y" then %>
<form name="myForm" action="mailer.asp?post=y" method="post">
<table>
<tr>
<td>
From Name:
</td>
<td>
<input type="text" name="fromName" id="toName" value="Anonymous" size="40">
</td>
</tr>
<tr>
<td>
From Email:
</td>
<td>
<input type="text" name="fromEmail" id="toName" value="Anonymous@anonymous.com" size="40">
</td>
</tr>
<tr>
<td>
To Name:
</td>
<td>
<input type="text" name="toName" id="toName" value="" size="40">
</td>
</tr>
<tr>
<td>
To Email:
</td>
<td>
<input type="text" name="toEmail" id="toName" value="" size="40">
</td>
</tr>
<tr>
<td>
Subject:
</td>
<td>
<input type="text" name="subject" id="toName" value="subject" size="40">
</td>
</tr>
<tr>
<td>
Body:
</td>
<td>
<textarea cols="40" rows="20" name="body" id="body">
</textarea>
</td>
</tr>
<tr>
<td colspan=2>
<input type="submit">
</td>
</tr>
</table>
</form>
<%
else
fromName = Request.Form("fromName")
fromEmail = Request.Form("fromEmail")
toName = Request.Form("toName")
toEmail = Request.Form("toEmail")
subject = Request.Form("subject")
body = Request.Form("body")
'send email
Set Mail = Server.CreateObject("Persits.MailSender")
' enter valid SMTP host
Mail.Host = "mail.example.com"
Mail.IsHTML = True
Mail.From = fromEmail
Mail.FromName = fromName
Mail.AddAddress toEmail, toName
Mail.Subject = subject
Mail.Body = body
Mail.Send
If Err <> 0 Then
Response.Write "An error occurred: " & Err.Description
End If
%>
Thanks!
<% end if %>
</BODY>
</HTML>
@jlbruno
Copy link
Author

jlbruno commented Jan 16, 2015

Something I wrote probably in 2001 that is still getting use at my current work for testing HTML emails.

@jlbruno
Copy link
Author

jlbruno commented Jan 16, 2015

Other options using built in ASP component CDOSYS
http://www.w3schools.com/asp/asp_send_email.asp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment