Another ASP script error message

This is a discussion on "Another ASP script error message" within the Classic ASP section. This forum, and the thread "Another ASP script error message are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Mar 30th, 2006, 13:38
Junior Member
Join Date: Jan 2006
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Question Another ASP script error message

Hi.... Sorry for this long post - can't be helped.

I'm still having problems trying to run this script through IIS

The script:

[<%@ Language=VBScript %>
<html>
<head>
</head>
<body>
<%
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
Dim iConf
Set iConf = CreateObject("CDO.Configuration")
Dim Flds
Set Flds = iConf.Fields
Flds( "http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup" '<-----xxx this path needs to point to the right place on the server. The hosts will know what it should say. Most probably, it will stay the same.
Flds.Update

Set iMsg.Configuration = iConf
iMsg.To = ""<--email ommited, but is there in actual script-->
iMsg.From = Request.Form.Item("email")
iMsg.Subject = "xyz Article Submission"
iMsg.AddAttachment Request.Form.Item("file")
iMsg.TextBody = "LastName: " & Request.Form.Item("LastName") & vbCrLf & "Initial: " & Request.Form.Item("Initial") & vbCrLf & "Location: " & Request.Form.Item("Location")
iMsg.Send
%>
<a href="file:///c:/Documents%20and%20Settings/ANDREW%20JACOB/My%20Documents/BrwsrStart/toplinks.htm">Back to home page</a>
</body>
</html>]

My problem is this error message:
Error Type:
CDO.Message.1 (0x8004020D)
At least one of the From or Sender fields is required, and neither was found.
/ASPwebTest/FormData2emailTest.asp, line 23

Don't understand... There is a "From" field, namely [iMsg.From = Request.Form.Item("email")].
Or am I supposed to replace ("email") with something? I have no 'Sender' field...

Any help invalluable. I've had the html pages themselves ready for ages, but can't progress because of this scripting headache. I'm on a tight budget...

Last edited by a.jenery; Mar 30th, 2006 at 13:40.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Mar 30th, 2006, 17:13
Up'n'Coming Member
Join Date: Mar 2006
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Another ASP script error message

I haven't messed around with emailing yet but first thing I would do is to insert everything directly to make sure the server can actual process the script. If the server does everything fine the you know that it is probably the way your trying to give the script your data and can proceed from there.
I have heard that sometimes including "" can fix the problem.

Also if you need to make sure your code is right you can use this:
Link
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Apr 3rd, 2006, 11:35
Junior Member
Join Date: Jan 2006
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Another ASP script error message

Many thanks....

Does that mean replace everything in brackets '("")' with an actual field value that would be entered in the originating html form or does 'insert everything directly' mean something else. I'm confused here... I'll try the link anyway.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Apr 4th, 2006, 21:48
Up'n'Coming Member
Join Date: Mar 2006
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Another ASP script error message

I'll explain with an example although like I stated I'm not sure if it will work.

Add "" around the items (to indicate that they are strings, I think)

This:
iMsg.From = Request.Form.Item("email")

goes to something like this:

iMsg.From = "'"& Request.Form.Item("email") &
"'"

as for entering everthing directly I mean instead of
iMsg.From = Request.Form.Item("email")

put:
iMsg.From = "some@email.com"

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Apr 8th, 2006, 11:02
Junior Member
Join Date: Jan 2006
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Another ASP script error message

Many thanks - sorry for not replying sooner...

I think now I get you - but I'm still confused here.

The script as shown in my initial post is based exactly on a script that someone has done for me, only there are fewer field names
[
"LastName: " & Request.Form.Item("LastName") ], etc, than in the original, but the syntax is exactly the same.
I know the original script works because he sent me the results of a test via email (unless this person has duped me and did this manually, which is a possibility).

Which ever, are you kindly suggesting that; for instance, [
"LastName: " & Request.Form.Item("LastName") ] should be changed to
[
"LastName: "'"& Request.Form.Item("LastName") & "'"], baring in mind that the '&' symbol preceeds the next clause. No contradiction here, you understand, only this would be a mild departure from the original script that this one is based on, but again, I'll try it anyway.
One more question. What does the ' between "" actually represent? Not splitting hairs here, but can you give me an actual example?

cheers

Look, I don't know, again many thanks

PS: What is ment by

put:
iMsg.From = "EMAIL REMOVED - Send PM to This User Instead"?

Last edited by a.jenery; Apr 8th, 2006 at 11:09.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Apr 14th, 2006, 00:58
Up'n'Coming Member
Join Date: Mar 2006
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Another ASP script error message

Quote:
Originally Posted by a.jenery

iMsg.From = "EMAIL REMOVED - Send PM to This User Instead"?
Opps! Didn't cache that I put in a bogus email "somemail [at] whereever.com" seems like the forums don't allow you to place your email publicly here (although it was a fake).
By the way before anything else did you try the original script on your server (or where ever it is your testing it now) before you changed the fields? If so did it work and what have you changed? Maybe you exclude an obligatory field. If it doesn't work then does it have the same error?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Apr 16th, 2006, 10:41
Junior Member
Join Date: Jan 2006
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Arrow Re: Another ASP script error message

Many thanks.

Yes, I tried the original ASP script (that the one in this thread is based on) with the person who wrote it actually present (the only thing that is different is the number of form-field variables in the script).

What happened: He typed in "http://localhost/FoulderName/formpage.htm" into the browser address bar (which is what you have to do to test a script via IIS), except that 'FoulderName' and 'formpage.htm' was substituted with the actual foulder name and actual htm file-name repectively.
Anyway, again the same error message came up:
( Error Type:
CDO.Message.1 (0x8004020D)
At least one of the From or Sender fields is required, and neither was found.
/FoulderName/formpage.asp, line 23).

At first he couldn't understand it, so he then went through it again, only this time he entered an email address in to the email-address-field in the HTM form page, and low and behold, it worked! The form was sent upon hitting the 'submit' button, I then checked my email address, and sure enough there was the message in my in-box. This was on the Saturday just gone, 15/April.

He then went home or wherever, and I then tested it again on my own just to make sure, and once again it worked.

However (there's allways a 'however' with me...), as of one day later, that is Sunday 16th, it seems I'm back to square one! After everything!

Why? Well, this is what I did: All I did was rename the htm file to something more meaningful and also renamed the ASP file to something more meaningful, and of course put the new ASP file name in the 'form action' of the HTM file. Everything else was the same - I didn't change any of the code, not anything.
So, once again I entered "http://localhost/FoulderName/formpage.htm" (only with the actual htm filename - not formpage.htm) and hit the enter-key, and unbelievably got the same error message (....
At least one of the From or Sender fields is required, and neither was found.
/ASPwebTest/FormData2emailTest.asp, line 23).

So, after everything, once again, I'm back to square one. This is like the 'Twilight Zone' or the 'Ghost in the Machine'.
I could just get in touch with the person who did the original script, but as he had helped me just this Saturday, this wouldn't look very good. He'll think I'm an idiot to put it mildly - so what do I do?

Sorry for very long reply.

PS: The original script (i.e. not the one in this thread....):

<%@ Language=VBScript %>
<html>
<head>
</head>
<body>
<%
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
Dim iConf
Set iConf = CreateObject("CDO.Configuration")
Dim Flds
Set Flds = iConf.Fields
Flds( "http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup" '<-----xxx this path needs to point to the right place on the server. The hosts will know what it should say. Most probably, it will stay the same.
Flds.Update

Set iMsg.Configuration = iConf
iMsg.To = "x@x.com" <---this is a dummy email address, not the actual one--->
iMsg.From = Request.Form.Item("email")
iMsg.Subject = "Form Submission"
iMsg.TextBody = "TradeName: " & Request.Form.Item("TradeName") & vbCrLf & "Address: " & Request.Form.Item("Address") & vbCrLf & "Post Code: " & Request.Form.Item("PostCode") & vbCrLf & "Contact Name: " & Request.Form.Item("ContactName") & vbCrLf & "Email: " & Request.Form.Item("Email") & vbCrLf & "Web Address: " & Request.Form.Item("WebAddress") & vbCrLf & "Holidays: " & Request.Form.Item("Holidays") & vbCrLf & "InnsPubs: " & Request.Form.Item("InnsPubs") & vbCrLf & "Leisure: " & Request.Form.Item("Leisure") & vbCrLf & "Hobbies: " & Request.Form.Item("Hobbies") & vbCrLf & "ComputersICT: " & Request.Form.Item("ComputersICT") & vbCrLf & "ConsumerElec: " & Request.Form.Item("ConsumerElec") & vbCrLf & "BankingFinance: " & Request.Form.Item("BankingFinance") & vbCrLf & "LandEstate: " & Request.Form.Item("LandEstate") & vbCrLf & "HomeHousehold: " & Request.Form.Item("HomeHousehold") & vbCrLf & "ShopsStores: " & Request.Form.Item("ShopsStores")
iMsg.AddAttachment Request.Form.Item("file"), Request.Form.Item("file")
iMsg.Send
%>
<a href="http://www.etc,etc">Back to home page</a> <!----xxx Everything here is the HTML of the page that appears after the submit button is pressed. Change it to whatever you want-->
</body>
</html>

Phew!!


Last edited by a.jenery; Apr 16th, 2006 at 10:45.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Apr 16th, 2006, 16:23
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,186
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
Re: Another ASP script error message

Do you have any other mail objects on the server? Such as ASPmail or SMTPMail, or CDONTS?
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Apr 18th, 2006, 03:22
Up'n'Coming Member
Join Date: Mar 2006
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Another ASP script error message

Basicly what seems to be happening is that it is not recieving the email from the form and without a from or sender field the script can't send an email. Make sure that the name that this form field has is the same name that the asp is using to call it. Since you where able to send an email before this there should be nothing wrong with the server but maybe an error in one of the two pages.

I used the asp script in your original post in a form I built for it, using the names that the script uses to call for the value of each element. Everything tested just fine without an error. So I am lead to believe that the error might be in the form page.

Oh and try to use the code tags (the button is the number symbol: #) when posting scripts. Makes it easier to read 'em. Thanks and hope this helps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Apr 18th, 2006, 10:45
Junior Member
Join Date: Jan 2006
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Arrow Re: Another ASP script error message

Many thanks for your replies.

I don't have a dedicated server as such, only an IIS instalation (unless this is the same thing), but in any case, I've now found out what the problem was.
It was my mistake all along, but understandable.

Dreamweaver 4.0 which is the editor I use, generates the following code if a form-action is not given after inserting a form itself via Dreamweaver's form tool - like:
[<form name="formname" method="post" action "" enctype="multipart/form-data">].
That is, it puts [enctype="multipart/form-data"] at the end.
Basically, the HTM form page that I emailed to the person who did the script for me, was exactly like this, as I didn't know (obviously) what the form action would be.
Anyway, after he'd done the ASP script, he emailed it to me together with the original HTM form page, except that this time the html code for the form was:
[<form action="filename.asp" method="post" name="formname">], i.e; with an ASP script as the action, but without [enctype="multipart/form-data"].
Understandably, this left a big question in my mind. As an experienced ASP programmer, I was certain that he wouldn't omit [enctype="multipart/form-data"] without good reason, but then I remembered him saying that he knew nothing of Dreamweaver (he hand codes everything), so I came to the conclusion that he omited this unwittingly - so I put it back in!
But this is where I went wrong and why the error message was comming up, and not because there was anything wrong with the script. That expalins why it worked for you (crazyluv) and not for me.

So, I'm OK now

Last edited by a.jenery; Apr 18th, 2006 at 10:50.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Apr 18th, 2006, 22:56
Up'n'Coming Member
Join Date: Mar 2006
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Another ASP script error message

Thats great to hear!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Apr 19th, 2006, 10:42
Junior Member
Join Date: Jan 2006
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Another ASP script error message

Thanks for your support. Yea - this is a 'funny' business we're in...

And all along I thought it was the ASP script. This is not the first time I've been 'duped' by Dreameaver in this way. It's famous (or infamous) slogan, 'What the web can be' has allways bugged me, because what something can be and what something is, is two different things.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Apr 19th, 2006, 14:29
Up'n'Coming Member
Join Date: Mar 2006
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Another ASP script error message

Oh, you are so right. Although I don't know 'What the web can be' :P since I don't use Dreamweaver but I know that, that slogan doesn't fit any HTML editor. Since 'What the web can be' is determined by our faithful W3 team and who ever else make web standards.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old Apr 21st, 2006, 01:10
Junior Member
Join Date: Jan 2006
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Another ASP script error message

I agree...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
asp, script, error, message

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
error message of webmail begeiste PHP Forum 2 May 27th, 2008 19:39
Keep getting error message Microsoft VBScript runtime error '800a01a8' cpando1974 Classic ASP 2 Aug 7th, 2007 12:00
Passing error message David Blake Starting Out 2 May 3rd, 2007 14:46
Please Help Fix This Error Message DannyP43 JavaScript Forum 3 Sep 26th, 2006 22:04
Error Message: TextBox accessman Databases 1 Oct 15th, 2005 01:07


All times are GMT. The time now is 04:00.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29