473,373 Members | 1,410 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,373 software developers and data experts.

Converting CDONTS to CDO to send mail from a guestbook to me....

I have been running CDONTS in my ASPpages to send emails to me sent from my
guestbook. It had been working fine untill I upgraded to Server 2003 (I am
also running Exchange 2003) all locally. I will include the code I
originally used. I understand I should switch from CDONTS to CDO mail but
after several sttempts I am finding a very hard time getting the new CDO mail
to work properly. Any assistance with this would be greatly appreciated.
Here is the code:

------------------------------------------------------------------------------------------------

'Set the response buffer to true so we execute all asp code before sending
the HTML to the clients browser
Response.Buffer = True

'Dimension variables
Dim strBody 'Holds the body of the e-mail
Dim objCDOMail 'Holds the mail server object
Dim strMyEmailAddress 'Holds your e-mail address
Dim strCCEmailAddress 'Holds any carbon copy e-mail addresses if you want
to send carbon copies of the e-mail
Dim strBCCEmailAddress 'Holds any blind copy e-mail addresses if you wish
to send blind copies of the e-mail
Dim strReturnEmailAddress 'Holds the return e-mail address of the user
'----------------- Place your e-mail address in the following sting
-----------------------

strMyEmailAddress = "me@mailserver.com"

'----------- Place Carbon Copy e-mail address's in the following sting,
separated by ; --------------

strCCEmailAddress = "" 'Use this string only if you want to send the carbon
copies of the e-mail

'----------- Place Blind Copy e-mail address's in the following sting,
separated by ; --------------

strBCCEmailAddress = "" 'Use this string only if you want to send the blind
copies of the e-mail

'------------------------------------------------------------------------------------------------
'Read in the users e-mail address
strReturnEmailAddress = Request.Form("email")
'Initialse strBody string with the body of the e-mail
strBody = "<h2>E-mail sent from form on Web Site</h2>"
strBody = strBody & "<br><b>Name: </b>" & Request.Form("firstName") & " " &
Request.Form("lastName")
strBody = strBody & "<br><b>E-mail: </b>" & strReturnEmailAddress
strBody = strBody & "<br><br><b>Comments: - </b><br>" &
Replace(Request.Form("enquiry"), vbCrLf, "<br>")
'Check to see if the user has entered an e-mail address and that it is a
valid address otherwise set the e-mail address to
your own otherwise the e-mail will be rejected
If Len(strReturnEmailAddress)
< 5 OR NOT Instr(1, strReturnEmailAddress, " ") = 0 OR InStr(1,
strReturnEmailAddress, "@", 1)
< 2 OR InStrRev(strReturnEmailAddress, ".") < InStr(1,
strReturnEmailAddress, "@", 1) Then

'Set the return e-mail address to your own
strReturnEmailAddress = strMyEmailAddress
End If
'Send the e-mail

'Create the e-mail server object
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")

'Who the e-mail is from (this needs to have an e-mail address in it for the
e-mail to be sent)
objCDOMail.From = Request.Form("firstName") & " " & Request.Form("lastName")
& " <" & strReturnEmailAddress & ">"

'Who the e-mail is sent to
objCDOMail.To = strMyEmailAddress

'Who the carbon copies are sent to
objCDOMail.Cc = strCCEmailAddress

'Who the blind copies are sent to
objCDOMail.Bcc = strBCCEmailAddress

'Set the e-mail body format (0=HTML 1=Text)
objCDOMail.BodyFormat = 0

'Set the mail format (0=MIME 1=Text)
objCDOMail.MailFormat = 0

'Set the subject of the e-mail
objCDOMail.Subject = "Guestbook Submission"

'Set the main body of the e-mail
objCDOMail.Body = strBody

'Importance of the e-mail (0=Low, 1=Normal, 2=High)
objCDOMail.Importance = 1

'Send the e-mail
objCDOMail.Send

'Close the server object
Set objCDOMail = Nothing
%>
<html>
<head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>Thank you</title>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#990099"
alink="#FF0000">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="2">
<h1 align="center">Success !! !! !!</h1>
</td>
</tr>
</table>
<br>
<br>
<table width="85%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><B><h3> Thank-you <% = Request.Form("firstName")
%>&nbsp;<% = Request.Form("lastName") %>
for signing our guestbook. </h3>
<br>
</td>
</tr>
</table>
------------------------------------------------------------------------------------------------

Not sure if this is necessary or not but this is the code from the guestbook
front page.....
------------------------------------------------------------------------------------------------

<!-- Javascript function to check the submitted form has been filled in
correctly before submitting -->
<SCRIPT language="JavaScript">
<!-- Hide from older browsers

//Check the enquiry form is filled in correctly
function CheckForm () {

//Initialise variables
var errorMsg = "";

//Check for a first name
if (document.frmEnquiry.firstName.value == ""){
errorMsg += "\n\tFirst Name \t- Enter your First Name";
}

//Check for a last name
if (document.frmEnquiry.lastName.value == ""){
errorMsg += "\n\tLast Name \t- Enter your Last Name";
}

//Check for an e-mail address and that it is valid
if ((document.frmEnquiry.email.value == "") ||
(document.frmEnquiry.email.value.length > 0 &&
(document.frmEnquiry.email.value.indexOf("@",0) == - 1 ||
document.frmEnquiry.email.value.indexOf(".",0) == - 1))) {
errorMsg += "\n\tE-mail Address \t- Enter your valid e-mail address";
}

//Check for an enquiry
if (document.frmEnquiry.enquiry.value == "") {
errorMsg += "\n\tComments \t\t- Enter comments please";
}

//If there is aproblem with the form then display an error
if (errorMsg != ""){
msg = "_________________________________________________ _____________\n\n";
msg += "Your guestbook submition has not been sent because there are
problem(s) with the form.\n";
msg += "Please correct the problem(s) and re-submit the form.\n";
msg += "_________________________________________________ _____________\n\n";
msg += "The following field(s) need to be corrected: -\n";

errorMsg += alert(msg + errorMsg + "\n\n");
return false;
}

return true;
}
// -->
</script>
<!-- Close the HTML document head -->
</head>
<!-- Start the HTML body -->
' <body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#990099"
alink="#FF0000">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> <br>
<h1 align="center">Please sign our GuestBook</h1>
</td>
</tr>
</table>
<table width="85%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="90%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td>
<form method="post" name="frmEnquiry" action="thanks.asp"
onSubmit="return CheckForm();">
<table width="450" border="0" align="center" cellpadding="0"
cellspacing="0" >
<!-- First tabe row -->
<tr>
<td colspan="3"> <font size="2"> *Indicates required fields
</b></font>
</tr>

<!-- second table row -->

<tr>

<td width="265"><B>First Name* <br>
<input maxlength="30" name="firstName">
</td>
<!-- Coloum two in the second table row -->
<td width="185" colspan="2"><B>Last Name* <br>
<input maxlength="30" name="lastName">
</td>
</tr>
<!-- Third table row spread over 3 coloumns -->
<tr>
<td width="265"><B>E-mail Address* <br>
<input maxlength="255" name="email">
</td>
<td width="185" colspan="2"> </td>
</tr>
<td colspan="3" height="170"><B>Comments* <br>
<textarea name="enquiry" cols="50" rows="10"></textarea>
</td>
</tr>
<tr align="center">
<td colspan="3" height="36">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Clear Form">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
------------------------------------------------------------------------------------------------
Any help with this is greatly appreciated !!
Jul 29 '05 #1
6 11148
Hi Rick,

May I suggest that instead of posting all the lines in your file and saying
that you're having trouble getting something to work properly that you
instead explain to us what isn't working, what errors you're getting, what
unexpected results you're getting, and only post the relevant code?

Ray at work

"DigitalRick" <Di*********@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.com...
I have been running CDONTS in my ASPpages to send emails to me sent from my guestbook. It had been working fine untill I upgraded to Server 2003 (I am also running Exchange 2003) all locally. I will include the code I
originally used. I understand I should switch from CDONTS to CDO mail but
after several sttempts I am finding a very hard time getting the new CDO mail to work properly. Any assistance with this would be greatly appreciated.
Here is the code:

Jul 29 '05 #2
Several working code samples here:
http://www.aspfaq.com/2026

Writing a simple one that works and then augmenting it would probably be an
easier approach than reverse engineering your existing code.


"DigitalRick" <Di*********@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.com...
I have been running CDONTS in my ASPpages to send emails to me sent from
my
guestbook. It had been working fine untill I upgraded to Server 2003 (I
am
also running Exchange 2003) all locally. I will include the code I
originally used. I understand I should switch from CDONTS to CDO mail but
after several sttempts I am finding a very hard time getting the new CDO
mail
to work properly. Any assistance with this would be greatly appreciated.

Jul 29 '05 #3
As Aaron says see: > http://www.aspfaq.com/2026
make sure you read the part at the bottom about "80040222" or "80040220"
errors. there are security patches that block access to the metabase by the
anonymous user account.

--
--Mark Schupp
"DigitalRick" <Di*********@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.com...
I have been running CDONTS in my ASPpages to send emails to me sent from
my
guestbook. It had been working fine untill I upgraded to Server 2003 (I
am
also running Exchange 2003) all locally. I will include the code I
originally used. I understand I should switch from CDONTS to CDO mail but
after several sttempts I am finding a very hard time getting the new CDO
mail
to work properly. Any assistance with this would be greatly appreciated.
Here is the code:

------------------------------------------------------------------------------------------------

'Set the response buffer to true so we execute all asp code before sending
the HTML to the clients browser
Response.Buffer = True

'Dimension variables
Dim strBody 'Holds the body of the e-mail
Dim objCDOMail 'Holds the mail server object
Dim strMyEmailAddress 'Holds your e-mail address
Dim strCCEmailAddress 'Holds any carbon copy e-mail addresses if you want
to send carbon copies of the e-mail
Dim strBCCEmailAddress 'Holds any blind copy e-mail addresses if you wish
to send blind copies of the e-mail
Dim strReturnEmailAddress 'Holds the return e-mail address of the user
'----------------- Place your e-mail address in the following sting
-----------------------

strMyEmailAddress = "me@mailserver.com"

'----------- Place Carbon Copy e-mail address's in the following sting,
separated by ; --------------

strCCEmailAddress = "" 'Use this string only if you want to send the
carbon
copies of the e-mail

'----------- Place Blind Copy e-mail address's in the following sting,
separated by ; --------------

strBCCEmailAddress = "" 'Use this string only if you want to send the
blind
copies of the e-mail

'------------------------------------------------------------------------------------------------
'Read in the users e-mail address
strReturnEmailAddress = Request.Form("email")
'Initialse strBody string with the body of the e-mail
strBody = "<h2>E-mail sent from form on Web Site</h2>"
strBody = strBody & "<br><b>Name: </b>" & Request.Form("firstName") & " "
&
Request.Form("lastName")
strBody = strBody & "<br><b>E-mail: </b>" & strReturnEmailAddress
strBody = strBody & "<br><br><b>Comments: - </b><br>" &
Replace(Request.Form("enquiry"), vbCrLf, "<br>")
'Check to see if the user has entered an e-mail address and that it is a
valid address otherwise set the e-mail address to
your own otherwise the e-mail will be rejected
If Len(strReturnEmailAddress)
< 5 OR NOT Instr(1, strReturnEmailAddress, " ") = 0 OR InStr(1,
strReturnEmailAddress, "@", 1)
< 2 OR InStrRev(strReturnEmailAddress, ".") < InStr(1,
strReturnEmailAddress, "@", 1) Then

'Set the return e-mail address to your own
strReturnEmailAddress = strMyEmailAddress
End If
'Send the e-mail

'Create the e-mail server object
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")

'Who the e-mail is from (this needs to have an e-mail address in it for
the
e-mail to be sent)
objCDOMail.From = Request.Form("firstName") & " " &
Request.Form("lastName")
& " <" & strReturnEmailAddress & ">"

'Who the e-mail is sent to
objCDOMail.To = strMyEmailAddress

'Who the carbon copies are sent to
objCDOMail.Cc = strCCEmailAddress

'Who the blind copies are sent to
objCDOMail.Bcc = strBCCEmailAddress

'Set the e-mail body format (0=HTML 1=Text)
objCDOMail.BodyFormat = 0

'Set the mail format (0=MIME 1=Text)
objCDOMail.MailFormat = 0

'Set the subject of the e-mail
objCDOMail.Subject = "Guestbook Submission"

'Set the main body of the e-mail
objCDOMail.Body = strBody

'Importance of the e-mail (0=Low, 1=Normal, 2=High)
objCDOMail.Importance = 1

'Send the e-mail
objCDOMail.Send

'Close the server object
Set objCDOMail = Nothing
%>
<html>
<head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>Thank you</title>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#990099"
alink="#FF0000">
<table width="95%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td height="2">
<h1 align="center">Success !! !! !!</h1>
</td>
</tr>
</table>
<br>
<br>
<table width="85%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td align="center"><B><h3> Thank-you <% = Request.Form("firstName")
%>&nbsp;<% = Request.Form("lastName") %>
for signing our guestbook. </h3>
<br>
</td>
</tr>
</table>
------------------------------------------------------------------------------------------------

Not sure if this is necessary or not but this is the code from the
guestbook
front page.....
------------------------------------------------------------------------------------------------

<!-- Javascript function to check the submitted form has been filled in
correctly before submitting -->
<SCRIPT language="JavaScript">
<!-- Hide from older browsers

//Check the enquiry form is filled in correctly
function CheckForm () {

//Initialise variables
var errorMsg = "";

//Check for a first name
if (document.frmEnquiry.firstName.value == ""){
errorMsg += "\n\tFirst Name \t- Enter your First Name";
}

//Check for a last name
if (document.frmEnquiry.lastName.value == ""){
errorMsg += "\n\tLast Name \t- Enter your Last Name";
}

//Check for an e-mail address and that it is valid
if ((document.frmEnquiry.email.value == "") ||
(document.frmEnquiry.email.value.length > 0 &&
(document.frmEnquiry.email.value.indexOf("@",0) == - 1 ||
document.frmEnquiry.email.value.indexOf(".",0) == - 1))) {
errorMsg += "\n\tE-mail Address \t- Enter your valid e-mail address";
}

//Check for an enquiry
if (document.frmEnquiry.enquiry.value == "") {
errorMsg += "\n\tComments \t\t- Enter comments please";
}

//If there is aproblem with the form then display an error
if (errorMsg != ""){
msg =
"_________________________________________________ _____________\n\n";
msg += "Your guestbook submition has not been sent because there are
problem(s) with the form.\n";
msg += "Please correct the problem(s) and re-submit the form.\n";
msg +=
"_________________________________________________ _____________\n\n";
msg += "The following field(s) need to be corrected: -\n";

errorMsg += alert(msg + errorMsg + "\n\n");
return false;
}

return true;
}
// -->
</script>
<!-- Close the HTML document head -->
</head>
<!-- Start the HTML body -->
' <body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#990099"
alink="#FF0000">
<table width="95%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td> <br>
<h1 align="center">Please sign our GuestBook</h1>
</td>
</tr>
</table>
<table width="85%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td>
<table width="90%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td>
<form method="post" name="frmEnquiry" action="thanks.asp"
onSubmit="return CheckForm();">
<table width="450" border="0" align="center" cellpadding="0"
cellspacing="0" >
<!-- First tabe row -->
<tr>
<td colspan="3"> <font size="2"> *Indicates required
fields
</b></font>
</tr>

<!-- second table row -->

<tr>

<td width="265"><B>First Name* <br>
<input maxlength="30" name="firstName">
</td>
<!-- Coloum two in the second table row -->
<td width="185" colspan="2"><B>Last Name* <br>
<input maxlength="30" name="lastName">
</td>
</tr>
<!-- Third table row spread over 3 coloumns -->
<tr>
<td width="265"><B>E-mail Address* <br>
<input maxlength="255" name="email">
</td>
<td width="185" colspan="2"> </td>
</tr>
<td colspan="3" height="170"><B>Comments* <br>
<textarea name="enquiry" cols="50" rows="10"></textarea>
</td>
</tr>
<tr align="center">
<td colspan="3" height="36">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Clear Form">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
------------------------------------------------------------------------------------------------
Any help with this is greatly appreciated !!

Jul 29 '05 #4
Sorry, in my haste to include as much information as possible I left out the
most important part.

The exact error I am getting when you click "submit" is:

Microsoft VBScript runtime error "800a0046"
Permission denied
/sarah/thanks.asp, line 164

That lines appears to be pointing to objCDOMail.Send

Please let me know if I have left any other necessary imformation out.

Rick

"Ray Costanzo [MVP]" wrote:
Hi Rick,

May I suggest that instead of posting all the lines in your file and saying
that you're having trouble getting something to work properly that you
instead explain to us what isn't working, what errors you're getting, what
unexpected results you're getting, and only post the relevant code?

Ray at work

"DigitalRick" <Di*********@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.com...
I have been running CDONTS in my ASPpages to send emails to me sent from

my
guestbook. It had been working fine untill I upgraded to Server 2003 (I

am
also running Exchange 2003) all locally. I will include the code I
originally used. I understand I should switch from CDONTS to CDO mail but
after several sttempts I am finding a very hard time getting the new CDO

mail
to work properly. Any assistance with this would be greatly appreciated.
Here is the code:


Jul 29 '05 #5
Got it working. Thank you VERY much for all the insight !!!

It was permissions under Exchsrv directory, I was working in the wrong
direstories all this time <argh !!!>

"Mark Schupp" wrote:
As Aaron says see: > http://www.aspfaq.com/2026
make sure you read the part at the bottom about "80040222" or "80040220"
errors. there are security patches that block access to the metabase by the
anonymous user account.

--
--Mark Schupp
"DigitalRick" <Di*********@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.com...
I have been running CDONTS in my ASPpages to send emails to me sent from
my
guestbook. It had been working fine untill I upgraded to Server 2003 (I
am
also running Exchange 2003) all locally. I will include the code I
originally used. I understand I should switch from CDONTS to CDO mail but
after several sttempts I am finding a very hard time getting the new CDO
mail
to work properly. Any assistance with this would be greatly appreciated.
Here is the code:

------------------------------------------------------------------------------------------------

'Set the response buffer to true so we execute all asp code before sending
the HTML to the clients browser
Response.Buffer = True

'Dimension variables
Dim strBody 'Holds the body of the e-mail
Dim objCDOMail 'Holds the mail server object
Dim strMyEmailAddress 'Holds your e-mail address
Dim strCCEmailAddress 'Holds any carbon copy e-mail addresses if you want
to send carbon copies of the e-mail
Dim strBCCEmailAddress 'Holds any blind copy e-mail addresses if you wish
to send blind copies of the e-mail
Dim strReturnEmailAddress 'Holds the return e-mail address of the user
'----------------- Place your e-mail address in the following sting
-----------------------

strMyEmailAddress = "me@mailserver.com"

'----------- Place Carbon Copy e-mail address's in the following sting,
separated by ; --------------

strCCEmailAddress = "" 'Use this string only if you want to send the
carbon
copies of the e-mail

'----------- Place Blind Copy e-mail address's in the following sting,
separated by ; --------------

strBCCEmailAddress = "" 'Use this string only if you want to send the
blind
copies of the e-mail

'------------------------------------------------------------------------------------------------
'Read in the users e-mail address
strReturnEmailAddress = Request.Form("email")
'Initialse strBody string with the body of the e-mail
strBody = "<h2>E-mail sent from form on Web Site</h2>"
strBody = strBody & "<br><b>Name: </b>" & Request.Form("firstName") & " "
&
Request.Form("lastName")
strBody = strBody & "<br><b>E-mail: </b>" & strReturnEmailAddress
strBody = strBody & "<br><br><b>Comments: - </b><br>" &
Replace(Request.Form("enquiry"), vbCrLf, "<br>")
'Check to see if the user has entered an e-mail address and that it is a
valid address otherwise set the e-mail address to
your own otherwise the e-mail will be rejected
If Len(strReturnEmailAddress)
< 5 OR NOT Instr(1, strReturnEmailAddress, " ") = 0 OR InStr(1,
strReturnEmailAddress, "@", 1)
< 2 OR InStrRev(strReturnEmailAddress, ".") < InStr(1,
strReturnEmailAddress, "@", 1) Then

'Set the return e-mail address to your own
strReturnEmailAddress = strMyEmailAddress
End If
'Send the e-mail

'Create the e-mail server object
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")

'Who the e-mail is from (this needs to have an e-mail address in it for
the
e-mail to be sent)
objCDOMail.From = Request.Form("firstName") & " " &
Request.Form("lastName")
& " <" & strReturnEmailAddress & ">"

'Who the e-mail is sent to
objCDOMail.To = strMyEmailAddress

'Who the carbon copies are sent to
objCDOMail.Cc = strCCEmailAddress

'Who the blind copies are sent to
objCDOMail.Bcc = strBCCEmailAddress

'Set the e-mail body format (0=HTML 1=Text)
objCDOMail.BodyFormat = 0

'Set the mail format (0=MIME 1=Text)
objCDOMail.MailFormat = 0

'Set the subject of the e-mail
objCDOMail.Subject = "Guestbook Submission"

'Set the main body of the e-mail
objCDOMail.Body = strBody

'Importance of the e-mail (0=Low, 1=Normal, 2=High)
objCDOMail.Importance = 1

'Send the e-mail
objCDOMail.Send

'Close the server object
Set objCDOMail = Nothing
%>
<html>
<head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>Thank you</title>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#990099"
alink="#FF0000">
<table width="95%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td height="2">
<h1 align="center">Success !! !! !!</h1>
</td>
</tr>
</table>
<br>
<br>
<table width="85%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td align="center"><B><h3> Thank-you <% = Request.Form("firstName")
%> <% = Request.Form("lastName") %>
for signing our guestbook. </h3>
<br>
</td>
</tr>
</table>
------------------------------------------------------------------------------------------------

Not sure if this is necessary or not but this is the code from the
guestbook
front page.....
------------------------------------------------------------------------------------------------

<!-- Javascript function to check the submitted form has been filled in
correctly before submitting -->
<SCRIPT language="JavaScript">
<!-- Hide from older browsers

//Check the enquiry form is filled in correctly
function CheckForm () {

//Initialise variables
var errorMsg = "";

//Check for a first name
if (document.frmEnquiry.firstName.value == ""){
errorMsg += "\n\tFirst Name \t- Enter your First Name";
}

//Check for a last name
if (document.frmEnquiry.lastName.value == ""){
errorMsg += "\n\tLast Name \t- Enter your Last Name";
}

//Check for an e-mail address and that it is valid
if ((document.frmEnquiry.email.value == "") ||
(document.frmEnquiry.email.value.length > 0 &&
(document.frmEnquiry.email.value.indexOf("@",0) == - 1 ||
document.frmEnquiry.email.value.indexOf(".",0) == - 1))) {
errorMsg += "\n\tE-mail Address \t- Enter your valid e-mail address";
}

//Check for an enquiry
if (document.frmEnquiry.enquiry.value == "") {
errorMsg += "\n\tComments \t\t- Enter comments please";
}

//If there is aproblem with the form then display an error
if (errorMsg != ""){
msg =
"_________________________________________________ _____________\n\n";
msg += "Your guestbook submition has not been sent because there are
problem(s) with the form.\n";
msg += "Please correct the problem(s) and re-submit the form.\n";
msg +=
"_________________________________________________ _____________\n\n";
msg += "The following field(s) need to be corrected: -\n";

errorMsg += alert(msg + errorMsg + "\n\n");
return false;
}

return true;
}
// -->
</script>
<!-- Close the HTML document head -->
</head>
<!-- Start the HTML body -->
' <body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#990099"
alink="#FF0000">
<table width="95%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td> <br>
<h1 align="center">Please sign our GuestBook</h1>
</td>
</tr>
</table>
<table width="85%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td>
<table width="90%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td>
<form method="post" name="frmEnquiry" action="thanks.asp"
onSubmit="return CheckForm();">
<table width="450" border="0" align="center" cellpadding="0"
cellspacing="0" >
<!-- First tabe row -->
<tr>
<td colspan="3"> <font size="2"> *Indicates required
fields
</b></font>
</tr>

<!-- second table row -->

<tr>

<td width="265"><B>First Name* <br>
<input maxlength="30" name="firstName">
</td>
<!-- Coloum two in the second table row -->
<td width="185" colspan="2"><B>Last Name* <br>
<input maxlength="30" name="lastName">
</td>
</tr>
<!-- Third table row spread over 3 coloumns -->
<tr>
<td width="265"><B>E-mail Address* <br>
<input maxlength="255" name="email">
</td>
<td width="185" colspan="2"> </td>
</tr>
<td colspan="3" height="170"><B>Comments* <br>
<textarea name="enquiry" cols="50" rows="10">

Jul 29 '05 #6
That should suffice. Your server probably has a directory,
C:\Inetpub\mailroot\pickup. When the CDO object executes its send method,
it's trying to write a file to that directory (the .msg file). If the
account running the script, typically IUSR_machine-name in a Web site,
doesn't have permission to write to that directory, you will get this
permission denied directory. So, try giving that user permission to write
to that directory.

Ray at work

"DigitalRick" <Di*********@discussions.microsoft.com> wrote in message
news:B8**********************************@microsof t.com...
Sorry, in my haste to include as much information as possible I left out the most important part.

The exact error I am getting when you click "submit" is:

Microsoft VBScript runtime error "800a0046"
Permission denied
/sarah/thanks.asp, line 164

That lines appears to be pointing to objCDOMail.Send

Please let me know if I have left any other necessary imformation out.

Rick

Jul 29 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: | last post by:
I did a working code with CDONTS on NT4 Now I am testing is on w2k and it looks like objCDONTS.Send is completely ignored. I think is it ignored because it throws no errors, neither does the...
7
by: Mario Leduc | last post by:
Hi, I have a page that sends user comments with CDONTS, works fine. Until I put a URL (http://192.168.0.1). If I use http://domain.com it works fine. Why with the numeric URL, CDONTS does not...
8
by: Boris | last post by:
Could someone please tell me if I can use CDONTS in W 2003 Server environment to send emails the same way it is used in W2K Server. I have heard that CDONTS is no longer available in W 2003 Server...
5
by: tom | last post by:
Hi people - I've been trying to make run this form mail with CDONTS but doesnt work at all! it's the first time am using it,could anybody check out where the error might be and let me know,...
1
by: Stimp | last post by:
I'm trying to send a mail using CDONTS with a .FROM email address that doesn't exist (like bob@nowhere.com), but it won't send the mail unless I put a valid .FROM email address (i.e. of an email...
4
by: Dr. Harvey Waxman | last post by:
I guess I should change from cdonts to cdosys. Since I am ignorant about asp I hope you forgive this basic question. There are two asp files for handling mail, the one that gets the info from a...
3
by: Pav | last post by:
Hi, I am developing a small Intranet web application which needs to send mails to our coporate Ids. I am using CDONTS, But my mails never leave Que folder. Not able to find out what the...
7
by: Paul | last post by:
I have just started work on a system using CDONTS to mail out. Whilst this is fine on the server, my local development machine is using XP Pro with IIS5.1 installed. Is there a way I can get the...
3
by: Prasad | last post by:
Hi all, I had to write a page in ASP which sends an email. I googled and was able to write the following code: <html> <body> <% Set Mail = Server.CreateObject("CDONTS.NewMail") Mail.To =...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.