Hey! To cut a long story short I had a PHP form, but the client has a windows server, so i had to re-code it to ASP, i havent used asp before, but i made a form and it worked well, i was testing it on godaddy, but then uploaded it all again and now the form doesnt work Here is the ASP file: <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% Option Explicit Response.Expires = 0 Dim strName Dim strAddress Dim strPostcode Dim strPhone Dim strMobile Dim strEmail Dim strHelp Dim strMore strName = Trim(Request.Form("name")) strAddress = Trim(Request.Form("address")) strPostcode = Trim(Request.Form("postcode")) strPhone = Trim(Request.Form("phone")) strMobile = Trim(Request.Form("mobile")) strEmail = Trim(Request.Form("email")) strHelp = Trim(Request.Form("help")) strMore = Trim(Request.Form("more")) Dim objMyMail1, msgBody, msgSubject Set objMymail1 = Server.CreateObject("CDONTS.NewMail") Dim strResponse strResponse = "Response from my site" msgSubject = strResponse msgBody ="<html>" msgBody = msgBody & "<head>" msgBody = msgBody & "<title>Help Request Form</title>" msgBody = msgBody & "<style type='text/css'>" msgBody = msgBody & "<!--" msgBody = msgBody & "p { font-family: Arial, Helvetica, sans-serif; font-size: 75%; color: #333333;}" msgBody = msgBody & "-->" msgBody = msgBody & "</style>" msgBody = msgBody & "</head>" msgBody = msgBody & "<body>" msgBody = msgBody & "<p>This is a response From ********</p>" msgBody = msgBody & "<p>Name: " msgBody = msgBody & strName msgBody = msgBody & "</p>" msgBody = msgBody & "<p>Address: " msgBody = msgBody & strAddress msgBody = msgBody & "</p>" msgBody = msgBody & "<p>Postcode: " msgBody = msgBody & strPostcode msgBody = msgBody & "</p>" msgBody = msgBody & "<p>Phone: " msgBody = msgBody & strPhone msgBody = msgBody & "</p>" msgBody = msgBody & "<p>Mobile: " msgBody = msgBody & strMobile msgBody = msgBody & "</p>" msgBody = msgBody & "<p>Email:<br>" msgBody = msgBody & strEmail msgBody = msgBody & "</p>" msgBody = msgBody & "<p>Help:<br>" msgBody = msgBody & strHelp msgBody = msgBody & "</p>" msgBody = msgBody & "<p>More:<br>" msgBody = msgBody & strMore msgBody = msgBody & "</p>" msgBody = msgBody & "</body></html>" objMyMail1.From = strEmail objMyMail1.To = "myemail@mail.com" objMyMail1.Subject = msgSubject objMyMail1.BodyFormat = 0 objMymail1.MailFormat = 0 objMyMail1.Body = msgBody objMyMail1.Send Set objMyMail1 = Nothing %> <html> <head> <title>Thank You</title> <style type="text/css"> <!-- p { font-family: Arial, Helvetica, sans-serif; font-size: 95%; color: #333333;} --> </style> </head> <body> <div id="mail"> <p> <br><br> <center> Thank you <BR><BR> <a href="javascript:window.close();"><u>Click here To Close This Window</u></a> </p> </body></html> Code (markup): and here is the form html code: <form action='mail.asp' method='post'> Name (optional): <input type='text' name='name' size=35><br><br> Address (optional): <input type='text' name='address' size=35><br><br> Postcode (optional): <input type='text' name='postcode' size=35><br><br> Telephone Number (optional): <input type='text' name='phone' size=35><br><br> Mobile Telephone Number (optional): <input type='text' name='mobile' size=35><br><br> Email Address (optional): <input type='text' name='email' size=35><br><br> How can I help?<BR> <SELECT NAME="help" SIZE="1"> <OPTION SELECTED>- Please Select One - <OPTION>Anti Social Behaviour <OPTION>Drugs <OPTION>Bullying <OPTION>Weapons <OPTION>Hate Crime <OPTION>Other </SELECT> </P> <BR><BR> <FONT color="6d1b67" size="2" font face="arial"> <B>Please Type Your Message Below (you MUST fill in this section): </b> <BR> <textarea name='more' ROWS=6 COLS=30></textarea><br> <BR> <input type='submit' value='Send'> </form> HTML: I cant understand what i have done, if someone can point me in the right direction, or tell me what I have done wrong I would be so grateful Thanks
what does it do that it does not work, I mean what error you get? EDIT: Another problem is that you do not replace characters such as ' or ", please do it in strName, strAddress, strHelp, strMore also allow only numbers in strPostcode, strPhone, strMobile
thats the odd thing, i get no error, the form says it is sent, but i receive no email Im not sure what you mean with the "or" ? Im totally new to asp With the form, it is an anonymous form, so the fields dont matter what is inserted, only the "more" section is important. Thanks
thanks for the reply, i got this error when i pressed send: Microsoft VBScript runtime error '800a01f4' Variable is undefined: 'myMail' /mail.asp, line 96
objMyMail1.To = "myemail@mail.com" hi mate try replace it with a working email address of yours for testing purpose, above is a generalized one.
Have them check the c:\inetpub\mailroot\queue folder - also the badmail folder and see if there are mails in there. If there are it may be worthwhile them restarting the Microsoft SMTP service - also check the port that Microsoft SMTP is set up to use - it might be conflicting with other mail programs on the server - so you may need to change the port number it uses to 26.
Try this, tested. <% Dim objEmail Set objEmail = Server.CreateObject("Persits.MailSender") objEmail.Username = "username" objEmail.Password = "password" objEmail.Host = "smtp.server.com" objEmail.FromName= "Your Name" objEmail.From = "from@yourserver.com" objEmail.AddAddress "to@yourserver.com" objEmail.Subject = "Subject" objEmail.AddReplyTo "replyto@yourserver.com" objEmail.Body = "Body" objEmail.Send Set objEmail = Nothing %>
I think you should check the above mail sending routine. However, I will try the code tonight and tell you. What's wrong with your code
your code is correct, it should work. The possible cause is, the CDONTS will not be installed on the server where you have uploaded the files. Please confirm it from your server service provider.