ASP Formmail Script

Well, I am in the homestretch of the new SSCC site. It is clean. It is simple. I like it.

Anyways, today I had planned to make the contact and sign-up pages. This is easy. I started at 11 and I am just now finishing up (3:30). As it turns out, my host makes sending mail VERY hard because of spam restrictions. I can’t use port 25, can’t use ANY mail script that does not validate the server, and PHP’s mail() is a big no no. I spent the better half of the last few hours looking for an ASP script that fits my needs and makes my server happy.

In case you are ever in this situation, I wanted to share my day’s work with you to save you time. It validates and it works great. Enjoy!

<%
Dim f_name
F_name = request.form(“name”)
dim f_email
f_email = request.form(“email”)
dim f_message
f_message= request.form(“content”)

Set oMail = Server.CreateObject(“SMTPsvg.Mailer”)
oMail.FromName = “from name”
oMail.FromAddress= “your email addy here”
oMail.RemoteHost = “your host here”
oMail.contentType = “text/html”
oMail.AddRecipient “”, “where it goes (must match FromAddress)”
oMail.Subject = “form mail subject”
HTML = “<!DOCTYPE HTML PUBLIC”"-//IETF//DTD HTML//EN”">”
HTML = HTML & “<html>”
HTML = HTML & “<head>”
HTML = HTML & “<meta http-equiv=”"Content-Type”"”
HTML = HTML & “content=”"text/html; charset=iso-8859-1″”>”
HTML = HTML & “<title>HTMLMail</title>”
HTML = HTML & “</head>”
HTML = HTML & “<body bgcolor=”"FFFFFF”">”
HTML = HTML & “Name:  ” & f_name & “<br>”
HTML = HTML & “Email:  ” & f_email & “<br>”
HTML = HTML & “Message:  ” & f_message & “<br>”
HTML = HTML & “</body>”
HTML = HTML & “</html>”

oMail.Bodytext = HTML
If oMail.SendMail Then
Response.redirect “redirect URL”  ‘or you could write by using .write function
Else
Response.Write “Mail not sent, send failure. Error was ” & oMail.Response & “<br>”
End If
oMail.ClearAllRecipients
oMail.ClearBodyText
Set oMail = Nothing
%>



8 reactions

Vasili

i hear there is possible to exploit gmails smtp for scripts as this. did you try that first? it could have conserved your time :-{)

yeah, I looked into that but Gmail makes you validate as well and it only works if sending to a gmail account. I couldn’t even connect to the server. If I would have started from scratch it wouldn’t have taken me that long, I wasted time trying to build on someone elses stuff and I it lost me.

I just went cross-eyed….

Darren Tobias

I’m not sure how this script validates, at least I don’t see it. The only info it gives the server is the hostname and account email, no password. Is it still working with Brinkster?

@Darren – It doesn’t need a password, my server allows JMail scripts to run without fully validating with a password. Maybe I shouldn’t say “validates” because it doesn’t validate the info in the form, I’m talking about authentication. If you need to use it with password authentication, add this after the remote.Host line:

oMail.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/sendusername”) = “YOUR-USERNAME”
oMail.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/sendpassword”) = “YOUR-PASSWORD”

It should work.

[...] 18-12-2008 An Introduction To Using Formmail With HTML Forms Saved by 1luke2 on Sun 14-12-2008 ASP Formmail Script Saved by agaviria on Fri 12-12-2008 Form Maker Pro ? Web Form Generator With Formmail Is A Form [...]

lietbript

cialis kaufen focused marrow

Отличная статья Спасибо огромное

Comment below



.