PDA

View Full Version : formmail.asp


bryonm
10-18-2007, 07:31 AM
I designed a form using FormMail.asp found here: http://www.brainjar.com/asp/formmail/default.asp. The webpage I'm using it on is here: http://shepsstaff.org/newpages/test_formmail_page.htm.

When the form is filled out, a new page opens with the fields filled in along with a message saying an email was sent. But the email never arrives, neither is an email bounced back to the email address filled out in the form. Could someone look at my code and see if I made some mistakes? Maybe you could look at the source code here: http://shepsstaff.org/newpages/formmail.asp as well. It's the script that's supposed to operate this whole thing.

One other question: do I have to do something in my discountasp.net account? I refreshed my permissions, but I don't know... I've been trying to make this thing happen for about a month now so any help I could get would be greatly appreciated.

Thanks!

wisemx
10-18-2007, 07:43 AM
This sort of thing is something I've helped a lot of people with.
If you want...ZIP up your code and send it to wisemx@hotmail.com
I'll look it over and make any needed changes, then I'll send it back.
All the best,
Mark

bryonm
10-18-2007, 09:38 AM
okay...

i sent you an email.

thanks...

wisemx
10-18-2007, 10:37 AM
I looked over the one you sent and would rather not put you through that so...
I created a self contained ASP contact page designed for use on DASP servers.
Sent it just now with your details, will work as is or you can make changes to it easily.
You're ready to go but should you need any more help with it let me know.
God's blessings,
Mark

bruce
10-19-2007, 02:43 AM
if you still can't figure it out, create a ticket w/ the from or to address. They can check the SMTP log to see if it is stuck in the queue somewhere.


Bruce

DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)

wisemx
10-19-2007, 02:49 AM
I tested it on my DASP server with his mail settings and it worked, sent him the mail.
On his DASP server it still didn't work so he said he is opening a support ticket. http://community.discountasp.net/emoticons/wink.gif

Again,a great community. http://community.discountasp.net/emoticons/yeah.gif

...Update:
Turns out the problem was something very simple, that I should have caught.
The VB script was checking to make sure only one "." dot was being used.
Nothing wrong with that check of course...
Unless the e-mail address being used has multiple dots and is valid. http://community.discountasp.net/emoticons/wink.gif

Post Edited (wisemx) : 10/19/2007 3:42:19 PM GMT

bryonm
10-19-2007, 11:05 AM
Mark:

I really dig the look of this form. I like the link for alternative email. But I still can't make it work. I sent you a reply from my other email address. Is there something I need to do on the server side of things? I'm very new and unfamiliar with DASP. I've added a blog and some email boxes... that's it... I'm green.

wisemx
10-19-2007, 11:18 AM
I did make a slight error in that last one, sent you an update after testing it.
You don't need to do anything, just make sure it exists on the server.
If you need more help let me know, it's not a problem.

ryanperry
10-06-2008, 01:55 AM
Hello,

Can you help me out by clueing me in? I am a beginner looking for a working form mail asp file to use. Can you send me the latest working version you refer to in this thread?

I've edited the formmail.asp file from bryon's message above, but keep getting 'Expected Statement' errors (see below) when running the page. My form is at the bottom of www.tjef.org/auction.aspx


Microsoft VBScript compilation error '800a0400'
Expected statement
/Scripts/formmail.asp, line 10
'- Customization of these values is required, see documentation. ----------\



Many thanks!!!

Ryan

Post Edited (tjef) : 10/6/2008 5:17:58 AM GMT

wisemx
10-06-2008, 11:46 AM
Hi,
I'll create an example for you that works here.
Salute,
Mark

Update: Probably best if I create a Webcast for this since it does get asked often.
My daughter has Soccer today but I'll try and get it done after the game.


Post Edited (wisemx) : 10/6/2008 8:28:52 PM GMT

ryanperry
10-07-2008, 04:28 AM
Thanks Mark - but I can't find the webcast or link. Maybe it was stripped from your note?

I'm at whimpy (at) gmail.com if you can send a link directly.

Many thanks for both your help here and with the other question I had on Dreamweaver recordsets. Every time I check the adobe site they want another $30-40 for code samples.

Truly appreciate your help.

wisemx
10-07-2008, 05:27 AM
Hi,
The Webcast is not on-line yet.
I'm still working on it and will update this thread when it's available.

I can create Webcasts for classic ASP in Dreamweaver but the version I have isn't new.
I'm still using Macromedia Studio 2004 MX for some of the technical help here.
I paid about $1,400 for it but have not updated because all I use anymore is Expression Studio and Visual Studio.
Salute,
Mark

wisemx
10-08-2008, 12:10 AM
Hi,
That will fail on your local machine unless you install IIS for ASP and the Persists component.
It will however run as is on DASP servers. As shown it is running on the test server I posted.


Just save that code as a page named concact.asp


As for Records...You want to save each Email into a DB?
Salute,
Mark

ryanperry
10-08-2008, 05:05 AM
Mark - this is very helpful. Just a couple follow ups:

1. Can I also post the form data to my database and have it mailed? Right now I've got a MM_Insert Record form working in dreamweaver but don't think that is the standard way to have form data load into my msql2000 db. I've been trying to get spry working but don't understand it. Too much useless help on adobe.com to browse through.

2. Set Mail = Server.CreateObject('Persits.MailSender') fails when I try to run this. Do I need to have the form and .asp in separate files, or can I just use the file you posted and reference itself inside the form action tag?

Cheers!

Ryan

wisemx
10-08-2008, 11:20 AM
Hi,
What I'm going to do for now is post the code you need here.
I just wrote this and tested it on a DiscountASP.NET IIS6 server.
To use this code save it to a file called contact.asp and put it in a folder on your site.
You may want to do it like this: http://yoursite.com/contact/contact.asp
The live sample is here: http://wisemxdasp.com/contact/contact.asp

Notice the line: Mail.AddAddress "youremail@you.com", "Your name"
In the code below change that line to any Email address you want to recieve the messages at.
You can put anything in the "Your name" area.
This does not need your site, passwords, anything...It uses the the Persists component which is installed here on the servers.
All you have to change to make it work is the line I specified.
Salute,
Mark
[quote]


<%
strHost = "localhost"
If Request("Send") <> "" Then
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = strHost
Mail.From = Request("From")
Mail.FromName = Request("FromName")
Mail.AddAddress "youremail@you.com", "Your name"
Mail.Subject = "Contact page"
Mail.Body = Request("Body")
strErr = ""
bSuccess = False
On Error Resume Next
Mail.Send
If Err <> 0 Then
strErr = Err.Description
else
bSuccess = True
End If
End If
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Contact</title></head>
[b]
<% If strErr <> "" Then %>
<h3>Error occurred: <% = strErr %></h3>
<% End If %>
<% If bSuccess Then %>
<center>[b]Success!</b> Message sent.</center>
<% End If %>
<form method="post" action="contact.asp">
<center>
<table cellspacing="0" cellpadding="2" width="550" bgcolor="#E0E0E0">
<tr>
<td>&amp;nbsp;</td>
<td align="center">[b]Contact form</b></td>
</tr>
<tr>
<td>Your Email:</td>
<td><input type="text" name="From" size="50" maxlength="50" /></td>
</tr>
<tr>
<td>Your Name:</td>
<td><input type="text" name="FromName" size="50" maxlength="50" /></td>
</tr>
<tr>
<td>Message:</td>
<td><textarea name="Body" cols="40" rows="10"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="Send" value="Send Message" /></td>
</tr>
</table>
</center>
</form>
</body>
</html></CODE>

ryanperry
10-09-2008, 04:38 AM
Thanks Mark! You really know your stuff.

Ultimately it would be great to have the same form data go into my DB and ALSO get emailed like your form does.

Funny thing is that I've now got a working DB record insertion form and your mailto form. Just don't understand how to combine the two actions into one. /emoticons/wink.gif

Ciao,

ksmigocki
12-04-2008, 09:48 AM
I designed a form in HTML in Dreamweaver and am not sure how to set up the server side of it to get it to send to an email address. I am not familiar with ASP or discountasp.net's hosting.
I've tried scripts that work on others but have not figured this one out. /emoticons/confused.gif

Would someone be able to guide me through it?

Here is the link to the test site.

www.finsoftware.com/newsite/product_inquiry.html (http://www.finsoftware.com/newsite/product_inquiry.html)

ksmigocki
12-12-2008, 02:31 AM
Hi Everyone. I ended up using http://www.brainjar.com/asp/formmail/default.asp to set up my email form and all is well for one of the forms, however I have a form that requires you to attach a file and the script will not support it. Any suggestions. I've been searching like crazy and no luck so far. Anybody!?!? /emoticons/mad.gif

bruce
12-12-2008, 08:01 AM
i don't think formmail accept attachments. you'll have to create a form yourself.

Bruce

DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)

jbutle4
02-23-2009, 08:19 AM
Bruce,

You can use the standard CDO mail object to send email with attachments. The standard CDO object library is installed in the Discountasp.net servers. Here is the reference page on how to use teh CDO mail object. It is also in the disountasp knowledge base:

http://classicasp.aspfaq.com/email/how-do-i-send-e-mail-with-cdo.html

http://www.paulsadowski.com/WSH/cdo.htm

There are some specific configuration scripts you have to add. The code I have in my page that is currently working is like this:

<%
set objMessage = createobject('cdo.message')
set objConfig = createobject('cdo.configuration')

' Setting the SMTP Server
Set Flds = objConfig.Fields
Flds.Item('http://schemas.microsoft.com/cdo/configuration/sendusing') = 2
Flds.Item('http://schemas.microsoft.com/cdo/configuration/smtpserver') = 'localhost'
Flds.update


Set objMessage.Configuration = objConfig
objMessage.To = 'you@YourHostedDomainName.com'
objMessage.From = 'someone@somewhere.com'
objMessage.Subject = 'This is a sample email sent using CDO'
objMessage.TextBody = 'Congratulation' & VbCrLf & 'If you receive this is, your mail component works'
objMessage.fields.update
objMessage.Send

Response.write 'Mail sent...'

set objMessage = nothing
set objConfig = nothing
%>

Pezell
03-26-2009, 07:48 AM
i am new to discountasp. i am trying to setup a contact form on our website but cant get it to work. i tried following the instructions to create the contact.asp that wisemx
Moderator showed an example of but i am unsuccesful in receiving the emails.

here is my asp form:
<%
strHost = "localhost"
If Request("Send") <> "" Then
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = strHost
Mail.From = Request("From")
Mail.FromName = Request("FromName")
Mail.AddAddress "pezell@worldwideoptimize.com", "Patrick Musolli"
Mail.Subject = "Contact page"
Mail.Body = Request("Body")
strErr = ""
bSuccess = False
On Error Resume Next
Mail.Send
If Err <> 0 Then
strErr = Err.Description
else
bSuccess = True
End If
End If
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Contact</title>
</head>
<% If strErr <> "" Then %>
<h3>Error occurred: <% = strErr %></h3>
<% End If %>
<% If bSuccess <> "True" Then %>
<center>Success! Message sent.<% = bSuccess %>
</center>
<% End If %>
<form method="post" action="contact.asp">
<center>
<table cellspacing="0" cellpadding="2" width="550" bgcolor="#E0E0E0">
<tr>
<td>&nbsp;</td>
<td align="center"><strong>Contact form</strong></td>
</tr>
<tr>
<td>Your Email:</td>
<td><input type="text" name="From" size="50" maxlength="50" /></td>
</tr>
<tr>
<td>Your Name:</td>
<td><input type="text" name="FromName" size="50" maxlength="50" /></td>
</tr>
<tr>
<td>Message:</td>
<td><textarea name="Body" cols="40" rows="10"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="Send" value="Send Message" /></td>
</tr>
</table>
</center>
</form>

i am familiar with using php forms and working with linux servers, is there a way i can use my contact.php form instead? and what do i need to do to activate php?

mjp
04-17-2009, 08:58 AM
i am familiar with using php forms and working with linux servers, is there a way i can use my contact.php form instead? and what do i need to do to activate php?php is active by default. Have you tried your php contact form?