473,403 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Forum email send with ASP

6
Hi guys,

I'm a pretty basic coder with very limited skills. I've been researching this question everywhere and I can't find anything that works.

What I'm trying to do is simply send a form which is filled out on their webpage, to their email address. Currently I am using a mailto: function which I desperately want to avoid. Also, if it helps this site is hosted through godaddy (windows package), if that makes any difference. Here is the HTML for my form:

Expand|Select|Wrap|Line Numbers
  1.   <form id="pipform" enctype="text/plain" action="mailto:info@planitperfect.net?subject=Plan it Perfect" method="post" onsubmit="javascript:return validateall(this);">
  2.     <fieldset style="border:none;">
  3.     <label for="">Name:</label><br />
  4.     <input type="text" id="name" name="name" /><br />
  5.     <label for="">Email:</label><br />
  6.     <input type="text" id="email" name="email" /><br />
  7.     <label for="area">Phone:</label><br />
  8.     <input type="text" id="area" name="area" size="3" maxlength="3" /> -
  9.     <input type="text" id="first3" name="first3" size="3" maxlength="3" /> -
  10.     <input type="text" id="last4" name="last4" size="4" maxlength="4" /><br />
  11.     <label for="list">How did you hear of us?</label><br />
  12.     <select id="list" name="list" name="Hear">
  13.     <option>---------</option>
  14.     <option>Friend</option>
  15.     <option>Internet</option>
  16.     <option>Flyer</option>
  17.     <option>Wedding</option>
  18.     </select>
  19.     <br />  
  20.     <label for="inquiry">Inquiry, Comment, or Suggestion:</label><br />
  21.     <textarea id="inquiry" name="inquiry" rows="3" cols="30" name="inquiry"></textarea><br /><br />
  22.     <input type="submit" id="submit" value="Submit" />
  23.     <input type="reset" id="reset" name="reset" />
  24.     </fieldset>
  25.   </form>
  26.  
I've tried a few different options, but when it sends I usually get something like "post not allowed for request.asp."

So I'm pretty stuck, any help would be appreciated. At least a push in the right direction?
Sep 7 '08 #1
7 2073
SAF22
6
Also, I forgot to mention the form is already validated through JavaScript. Plus if it helps, I also tried doing this send through PHP which I later found out isn't supported by the web host.
Sep 8 '08 #2
JamieHowarth0
533 Expert 512MB
Hi SAF22,

Firstly, welcome to Bytes IT Community!

Secondly, you can either use ASP or PHP mail functions (depending on whether your GoDaddy host account supports it). It simply involves setting your form method to POST, then setting the action attribute on the form to the script that will send the mail for you.

In ASP, the easiest way to send mail is using the Windows controls CDO/CDOSYS (on Windows Server 2003) or CDONTS (on NT4/Win2K systems).

Expand|Select|Wrap|Line Numbers
  1. 'Sending SMTP mail via port 25 using CDOSYS
  2. 'This VB sample uses CDOSYS to send SMTP mail using the cdoSendUsingPort option and specifying a SMTP host.
  3.  
  4. ' Note: It is recommended that all input parameters be validated when they are
  5. ' first obtained from the user or user interface.
  6. Private Sub SendMessage(strTo As String, strFrom As String)
  7.  
  8. 'Send using the Port on a SMTP server
  9. Dim iMsg As New CDO.Message
  10. Dim iConf As New CDO.Configuration
  11. Dim Flds As ADODB.Fields
  12. Dim strHTML
  13.  
  14. Set Flds = iConf.Fields
  15.  
  16. With Flds
  17.     .Item(cdoSendUsingMethod) = cdoSendUsingPort
  18.     .Item(cdoSMTPServer) = "yourmailserver.example.com"
  19.     'Use SSL to connect to the SMTP server:
  20.     '.Item(cdoSMTPUseSSL) = True
  21.     .Item(cdoSMTPConnectionTimeout) = 10
  22.     .Update
  23. End With
  24.  
  25. ' Build HTML for message body
  26. strHTML = "<HTML>"
  27. strHTML = strHTML & "<HEAD>"
  28. strHTML = strHTML & "<BODY>"
  29. strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
  30. strHTML = strHTML & "</BODY>"
  31. strHTML = strHTML & "</HTML>"
  32.  
  33. With iMsg
  34.     Set .Configuration = iConf
  35.     .To = strTo
  36.     .From = strFrom
  37.     .Subject = "This is a test CDOSYS message (Sent by Port)"
  38.     .HTMLBody = strHTML
  39.     '.TextBody = "This is the text body of the message..."
  40.  
  41.     .Send
  42. End With
  43.  
  44. ' cleanup of variables
  45. Set iMsg = Nothing
  46. Set iConf = Nothing
  47. Set Flds = Nothing
  48.  
  49. End Sub
  50.  
Sample taken from MSDN.

Hope this helps.

Best regards,

medicineworker
Sep 8 '08 #3
SAF22
6
Thank you for the welcome medicineworker!

So, what I did was take that code and placed it onto an .asp page (called test.asp). I changed my form action to action="test.asp", and set method to post (which it already was). I am not too sure what is going on with the script, but I wanted to see if I could at least get some kind of positive response . What happened is the same thing with the PHP actually. Here is what happens after the submit button:

Method POST is not allowed by /test.asp

This sounds to me like the web server isn't allowing ASP as well as PHP. Is this the case, or am I way off?

I'm very sorry, please bare with me as I am extremely new to this language. I have done some research on it and getting the feel for it, but still far from understanding!
Sep 8 '08 #4
JamieHowarth0
533 Expert 512MB
Hi there,

Yes, that sounds about right. It would appear that your web server refuses to accept HTTP POST requests for most, if not all, server-side languages. If this is a third-party host then you need to speak to them to see if they will relax the ASP permissions. If they won't, then use the GET method instead, and change the code to get Request.QueryString("my-form-field-name") instead.

FYI (a little background) - every time you request a page, an HTTP request is made, using one of two methods - GET or POST. GET simply requests the requested URL from the server, and any additional data is submitted as a querystring (e.g. test.asp?message-title=Hello%20world&message-body=This%20is%20a%20test) - notice the way it's encoded so even spaces can be transmitted safely.
POST sends data WITH the request, in the headers, and is therefore "invisible" to the user. POST carries security issues for third-party hosting companies as they suspect every file upload is a virus that will bring down their server farm!

In this instance, unless you have a specific reason to use POST (secure, confidential messages) then simply switch to GET, it GET's you round the problem (gotta love my puns!)

Best regards,

medicineworker
Sep 9 '08 #5
DrBunchman
979 Expert 512MB
it GET's you round the problem (gotta love my puns!)
You've got to love that kind of punning! Keep 'em coming...

Dr B
Sep 9 '08 #6
SAF22
6
Hahaha.

Thanks for your help, I really appreciate it! I should be able to work this out now!
Sep 10 '08 #7
dlynx
3
You might also want to try the mMail library found here:

http://www.virtualthinking.com/loadhtml.php?where=scripts&what=art_show.php&db_ta rget=00000000023
Oct 1 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Paul Kinsella | last post by:
---------------------------------------------------------------------- NEWS BULLETIN - http://www.companywire.net ---------------------------------------------------------------------- Company...
0
by: Technical Resercher | last post by:
My agency is organizing an online forum group. Our purpose is to gather information from consumers, like you, on dedicated servers. We want to gain knowledge about the industry, the dedicated...
14
by: supz | last post by:
Hi, I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue. I'm using my...
13
by: Joni Nieminen | last post by:
Is there any code or script which do forum in the page! I can do little javascript.. Help?!
0
by: sravan_reddy001 | last post by:
I am developing a e-news website.. i bought space from websuvidha.org.. they are also providing some emails... http://mail.asianmedianetworkinc.com/ http://216.157.131.123/index.php the...
4
by: GaryDean | last post by:
Is there a forum somewhere specializing in WSE 3.0? I am going through the "Microsoft Web Service Security Patterns and Practices" book/pdf and it has a link to a community forum with a url of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.