Help with Form submission using ASP and the CDOSYS object.

Hi, I am having a nightmare.  I have a website and I am trying to submit forms details to my email using ASP with the CDOSYS object.

I have the following code

<%

If request("submit") <> "" THEN
Set objEMail = Server.CreateObject("CDO.Message")
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Confi = objConfig.Fields
Confi("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
Confi("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "C:\inetpub\mailroot\pickup"
Confi.Update
Set objEMail.Configuration = objConfig
objEMail.To = "myemail@blah,blah,blah.co.uk"
objEMail.From = Request("from")
objEMail.Subject = Request("subject")
objEMail.TextBody = Request("message")  
objEMail.Send
Set objEMail = Nothing

Response.Write("Message Sent")
Else

%>

<form method="post" action="this.asp">
From Email: <INPUT type=text name="from"><br />
Subject: <INPUT type=text name="subject"><br />
Message: <TEXTAREA name="message" rows=10 cols=40></TEXTAREA><br />
<INPUT type="submit" value="Send" name="submit">
</form>

<%
End If
%>

I get no errors and my page reloads again as requested, but know information is sent to my email address why????

Hope someone can help......bye the way have changed my email address in the code and replaced it with a made up address...hence "myemail@blah,blah,blah.co.uk".

It sending me around the bend...please help.Cheers



dthomas31ukAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

davidlars99Commented:
what do you mean by this?
> I get no errors and my page reloads again as requested
0
MGrassmanCommented:
Is this a server you own or a hosting company.

If its a hosting company make sure
    Confi("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "C:\inetpub\mailroot\pickup"
is the correct setting.

If it's your machine are you able to send emails through your smpt server any other way.

0
dthomas31ukAuthor Commented:
The page this.asp is the name of the actual page that the code is in.  I get no errors but no data is sent to the mail address in question
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

MGrassmanCommented:
I'm sure you have done this but have you checked your spam mail or anything like that to see if it's getting re-routed.
0
nurbekCommented:
objEMail.From = Request("from")

should be a valid email

0
dthomas31ukAuthor Commented:
Dear nurbek...have just discovered that...thank you was ...entering anything in the form field while I was testing it...it works fine now.  Thanks

One other question for you how do I send information if I have more than four form fields on my web page because have discovered the objEMail. only has four parameters that allow you to store form data which are objEMail.To, objEMail.From , objEMail.Subject, objEMail.TextBody.  Are there any other objEmail parameters or do you have to write code differently.

Thank you
0
nurbekCommented:
'add to show the from name
 objCDOMail.From = "Sender<sender@sender.com>"

'to send in html format
objCDOMail.MailFormat = 0
objCDOMail.BodyFormat = 0
objCDOMail.Body = "line 1<br> Line 2"

0
dthomas31ukAuthor Commented:
Dear Nurbek How does that work then...can you explain please..... say I have got 7 forms
one called To,
one called from,
one called subject
one called comments,
one called dateofstart
one called dateoffinish
one called telephone

Cheers
0
nurbekCommented:
you have to organize it according to your code, make the desired message and then send it
msg = "hi, <br>" & Request("name") ....

here how to send the whole form elements

Dim myMessage  

'to get form elements
 
 For Each Field In Request.Form
          myMessage = myMessage & "<b>" &  Field & "</b>: " & Request.Form(Field) & "<BR>" & vbCrLf
     Next 'Field

Set objEMail = Server.CreateObject("CDO.Message")
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Confi = objConfig.Fields
Confi("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
Confi("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "C:\inetpub\mailroot\pickup"
Confi.Update
Set objEMail.Configuration = objConfig
objEMail.To = "myemail@blah,blah,blah.co.uk"
objEMail.From = Request("from")
objEMail.Subject = Request("subject")
objEMail.MailFormat = 0
objEMail.BodyFormat = 0
objEMail.TextBody = myMessage  
objEMail.Send
Set objEMail = Nothing
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.