Help with CDO issue

Help with CDO issue

am 12.11.2007 14:18:47 von Michael Iannaccone

I have some code here... it is attached to my website.. the website is flash
9 and i have a contact page with prefilled text boxes for name email phone
and message: this flash code calls for an ASP script. Very rusty with this,
i review most of the notes and i get an error:

CDO.Message.1 error '8004020d'

At least one of the From or Sender fields is required, and neither was found.


/contact.asp, line 20

here is the flash9 code for ref:

rec="support@micotechnology.com";
serv="asp";

var fields_descriptions= Array ("",
Array("t1", "your_name", "Your Name:"),
Array("t2", "your_email", "Your Email:"),
Array("t3", "telephone", "Telephone:"),
Array("t4", "message", "Message:"),
Array("t5", "field_2", "E-mail:"),
Array("t6", "field_3", "Address:"),
Array("t7", "field_4", "fax:")
);

function reset_txt(name,name2,value) {
path=eval(_target);
path[name2]="";
}



for (i=1; i<=fields_descriptions.length; i++) {
reset_txt("t"+i, fields_descriptions[i][1], fields_descriptions[i][2]);
}

and here is the .asp:

<%
for i=1 to 7
message=Request("message")
next
message=message + Request("message")
smtpServer = "smtpout.secureserver.net"
smtpPort = 25


name = Request("Your_Name:")
Set myMail = CreateObject("CDO.Message")
myMail.Subject = "from " & name
myMail.From = Request("Your_Email:")
myMail.To = Request("recipient")
myMail.HTMLBody = "Contact <br /> letter
" & message & ""
myMail.Configuration.Fields.Item("http://schemas.microsoft.
com/cdo/configuration/sendusing") = 2
myMail.Configuration.Fields.Item("http://schemas.microsoft.
com/cdo/configuration/smtpserver") = smtpServer
myMail.Configuration.Fields.Item("http://schemas.microsoft.
com/cdo/configuration/smtpserverport") = smtpPort
myMail.Configuration.Fields.Update
myMail.Send
%>



What the heck am i doing wrong here? i tried everything. thanks in advance

url:http://www.ureader.com/gp/1522-1.aspx

Re: Help with CDO issue

am 13.11.2007 10:16:02 von Anthony Jones

"Michael Iannaccone" wrote in message
news:7a76b2b6894e4d9eaea59ee0a2452309@newspe.com...
> I have some code here... it is attached to my website.. the website is
flash
> 9 and i have a contact page with prefilled text boxes for name email phone
> and message: this flash code calls for an ASP script. Very rusty with
this,
> i review most of the notes and i get an error:
>
> CDO.Message.1 error '8004020d'
>
> At least one of the From or Sender fields is required, and neither was
found.
>
>
> /contact.asp, line 20
>
> here is the flash9 code for ref:
>
> rec="support@micotechnology.com";
> serv="asp";
>
> var fields_descriptions= Array ("",
> Array("t1", "your_name", "Your Name:"),
> Array("t2", "your_email", "Your Email:"),
> Array("t3", "telephone", "Telephone:"),
> Array("t4", "message", "Message:"),
> Array("t5", "field_2", "E-mail:"),
> Array("t6", "field_3", "Address:"),
> Array("t7", "field_4", "fax:")
> );
>
> function reset_txt(name,name2,value) {
> path=eval(_target);
> path[name2]="";
> }
>
>
>
> for (i=1; i<=fields_descriptions.length; i++) {
> reset_txt("t"+i, fields_descriptions[i][1], fields_descriptions[i][2]);
> }
>
> and here is the .asp:
>
> <%
> for i=1 to 7
> message=Request("message")
> next
> message=message + Request("message")

The above code looks like nonsense to me. Access the same field value 7
times and assign it over and over into the same variable then append the
final value with another duplicate of the field value??! What's that all
about?

> smtpServer = "smtpout.secureserver.net"
> smtpPort = 25
>
>
> name = Request("Your_Name:")

Use Request.Form("Your_Name") explicitly and I suspect the field name
doesn't contain a colon at the end.

> Set myMail = CreateObject("CDO.Message")
> myMail.Subject = "from " & name

Since the from field is the best place to indicate where the email is form
isn't there a better use for the subject property?

> myMail.From = Request("Your_Email:")

Use:-

myEmail.From = """" & name & """ <" & Request.Form("Your_Email") & ">"


> myMail.To = Request("recipient")
> myMail.HTMLBody = "Contact<br /> > letter
" & message & ""

Use Server.HTMLEncode(message). If message contains < or & the HTML
generated would be corrupt.

> myMail.Configuration.Fields.Item("http://schemas.microsoft.
> com/cdo/configuration/sendusing") = 2
> myMail.Configuration.Fields.Item("http://schemas.microsoft.
> com/cdo/configuration/smtpserver") = smtpServer
> myMail.Configuration.Fields.Item("http://schemas.microsoft.
> com/cdo/configuration/smtpserverport") = smtpPort
> myMail.Configuration.Fields.Update
> myMail.Send
> %>
>
>
>
> What the heck am i doing wrong here? i tried everything. thanks in advance
>


I don't know anything about Flash and how or even if it emulates HTML Forms.

First thing I would do is built a simple HTML form that contains all the
fields you need. Then test your ASP code using the HTML form. When thats
working you can test the flash. If the flash doesn't work you'll know where
the fault is.

--
Anthony Jones - MVP ASP/ASP.NET