Last active
August 29, 2015 14:13
-
-
Save jlbruno/e4a2e72240d4fdec460f to your computer and use it in GitHub Desktop.
Local mailer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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="[email protected]" 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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Other options using built in ASP component CDOSYS
http://www.w3schools.com/asp/asp_send_email.asp