PC Review


Reply
Thread Tools Rate Thread

CDONTS to CDO script with saved fields

 
 
Shona
Guest
Posts: n/a
 
      9th Feb 2004
I've managed to change the basic cdo script
(http://www.aspfaq.com/show.asp?id=2026)



and it all works fine but in my cdont's script I had some extra lines.
These lines work fine in cdon'ts






I now get an error message in my cdo script
Microsoft VBScript runtime error '800a01a8'

Object required: ''

Confirmation3.asp, line 88



This is the Cdon'ts script which does exactly what I want it to do

<%
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.To = "mymail@com"
objCDOMail.From = FP_SavedFields("Name") & "." & FP_SavedFields("Surname") &
"@com "& " <" & FP_SavedFields("Name") & "." & FP_SavedFields("Surname") &
"@com" & ">"
objCDOMail.Subject = FP_SavedFields("Results")

strBody = strBody & "Dear " & FP_SavedFields("Name") & VbCrLf



strBody = strBody & "" & FP_SavedFields("Comment") & VbCrLf
objCDOMail.Body = strBody
objCDOMail.BodyFormat = 1
objCDOMail.MailFormat = 1
objCDOMail.Send
Set objCDOMail = Nothing
%>


This is the CDO script I've tried that gives me the error message also the
mail is not received



<%
Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "myserver"
.Update
End With

Set cdoMessage = CreateObject("CDO.Message")

With cdoMessage
Set .Configuration = cdoConfig
.From = "mymail@com"
.To = "mymail@com"



.Subject = "Sample CDO Message"
objCDOMail.From = FP_SavedFields("Name") & "." & FP_SavedFields("Surname")
& "@com "& " <" & FP_SavedFields("Name") & "." & FP_SavedFields("Surname")
& "@com" & ">"
objCDOMail.Subject = FP_SavedFields("Results")

strBody = strBody & "Dear " & FP_SavedFields("Name") & VbCrLf



strBody = strBody & "" & FP_SavedFields("Comment") & VbCrLf
objCDOMail.Body = strBody
.Send
End With

Set cdoMessage = Nothing
Set cdoConfig = Nothing
%>


Can anyone tell me where I'm going wrong?

Many thanks Shona







 
Reply With Quote
 
 
 
 
Jon
Guest
Posts: n/a
 
      9th Feb 2004
Hi Shona,
you need to include the cdo type library - copy and paste this above your
script
<!--
METADATA
TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library"
-->
<%
' your script
%>

(it needs to be outside your asp tags) and you should be in business

Jon
Microsoft MVP - FP


"Shona" <(E-Mail Removed)> wrote in message
news:c0812o$i7k$(E-Mail Removed)...
> I've managed to change the basic cdo script
> (http://www.aspfaq.com/show.asp?id=2026)
>
>
>
> and it all works fine but in my cdont's script I had some extra lines.
> These lines work fine in cdon'ts
>
>
>
>
>
>
> I now get an error message in my cdo script
> Microsoft VBScript runtime error '800a01a8'
>
> Object required: ''
>
> Confirmation3.asp, line 88
>
>
>
> This is the Cdon'ts script which does exactly what I want it to do
>
> <%
> Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
> objCDOMail.To = "mymail@com"
> objCDOMail.From = FP_SavedFields("Name") & "." & FP_SavedFields("Surname")

&
> "@com "& " <" & FP_SavedFields("Name") & "." & FP_SavedFields("Surname")

&
> "@com" & ">"
> objCDOMail.Subject = FP_SavedFields("Results")
>
> strBody = strBody & "Dear " & FP_SavedFields("Name") & VbCrLf
>
>
>
> strBody = strBody & "" & FP_SavedFields("Comment") & VbCrLf
> objCDOMail.Body = strBody
> objCDOMail.BodyFormat = 1
> objCDOMail.MailFormat = 1
> objCDOMail.Send
> Set objCDOMail = Nothing
> %>
>
>
> This is the CDO script I've tried that gives me the error message also

the
> mail is not received
>
>
>
> <%
> Set cdoConfig = CreateObject("CDO.Configuration")
>
> With cdoConfig.Fields
> .Item(cdoSendUsingMethod) = cdoSendUsingPort
> .Item(cdoSMTPServer) = "myserver"
> .Update
> End With
>
> Set cdoMessage = CreateObject("CDO.Message")
>
> With cdoMessage
> Set .Configuration = cdoConfig
> .From = "mymail@com"
> .To = "mymail@com"
>
>
>
> .Subject = "Sample CDO Message"
> objCDOMail.From = FP_SavedFields("Name") & "." &

FP_SavedFields("Surname")
> & "@com "& " <" & FP_SavedFields("Name") & "." &

FP_SavedFields("Surname")
> & "@com" & ">"
> objCDOMail.Subject = FP_SavedFields("Results")
>
> strBody = strBody & "Dear " & FP_SavedFields("Name") & VbCrLf
>
>
>
> strBody = strBody & "" & FP_SavedFields("Comment") & VbCrLf
> objCDOMail.Body = strBody
> .Send
> End With
>
> Set cdoMessage = Nothing
> Set cdoConfig = Nothing
> %>
>
>
> Can anyone tell me where I'm going wrong?
>
> Many thanks Shona
>
>
>
>
>
>
>



 
Reply With Quote
 
Shona
Guest
Posts: n/a
 
      9th Feb 2004
Hi Jon

thanks for the reply but I already have that included.

Any other ideas?

Cheers Shona
"Jon" <(E-Mail Removed)> wrote in message
news:#tFdm#(E-Mail Removed)...
> Hi Shona,
> you need to include the cdo type library - copy and paste this above your
> script
> <!--
> METADATA
> TYPE="typelib"
> UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
> NAME="CDO for Windows 2000 Library"
> -->
> <%
> ' your script
> %>
>
> (it needs to be outside your asp tags) and you should be in business
>
>



 
Reply With Quote
 
Jon
Guest
Posts: n/a
 
      9th Feb 2004
Hi,
thought that was too easy :-) I think the error is here
objCDOMail.From = FP_SavedFields("Name") & "." & FP_SavedFields("Surname")
& "@com "& " <" & FP_SavedFields("Name") & "." & FP_SavedFields("Surname")
& "@com" & ">"
objCDOMail.Subject = FP_SavedFields("Results")

Your message object is cdoMessage but in this part you're referencing
objCDOMail (I'm guessing you copied this from your old cdonts script) It
should be something like this
With cdoMessage
Set .Configuration = cdoConfig
.From = FP_SavedFields("Name") ' etc.....
.To = "mymail@com"
.Subject = FP_SavedFields("Results")
.TextBody = strBody
.Send
end with

Jon
Microsoft MVP - FP

"Shona" <(E-Mail Removed)> wrote in message
news:c085cb$7d1$(E-Mail Removed)...
> Hi Jon
>
> thanks for the reply but I already have that included.
>
> Any other ideas?
>
> Cheers Shona
> "Jon" <(E-Mail Removed)> wrote in message
> news:#tFdm#(E-Mail Removed)...
> > Hi Shona,
> > you need to include the cdo type library - copy and paste this above

your
> > script
> > <!--
> > METADATA
> > TYPE="typelib"
> > UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
> > NAME="CDO for Windows 2000 Library"
> > -->
> > <%
> > ' your script
> > %>
> >
> > (it needs to be outside your asp tags) and you should be in business
> >
> >

>
>



 
Reply With Quote
 
Shona
Guest
Posts: n/a
 
      9th Feb 2004
Thanks so nearly there!

..TextBody = strBody & "Dear " & FP_SavedFields("Name") & VbCrLf


..TextBody = strBody & "" & FP_SavedFields("Comment") & VbCrLf

but it only puts the last one comment in the mail.

Tried addying another field after Comment and then it just added that one
and not comment. How do I make it pick up all of the saved fields?

Cheers Shona


 
Reply With Quote
 
Jon
Guest
Posts: n/a
 
      9th Feb 2004
strBody = "Dear " & FP_SavedFields("Name") & VbCrLf
strBody = strBody & FP_SavedFields("Comment") & VbCrLf
and then
..TextBody = strBody

Jon

"Shona" <(E-Mail Removed)> wrote in message
news:c08a83$rad$(E-Mail Removed)...
> Thanks so nearly there!
>
> .TextBody = strBody & "Dear " & FP_SavedFields("Name") & VbCrLf
>
>
> .TextBody = strBody & "" & FP_SavedFields("Comment") & VbCrLf
>
> but it only puts the last one comment in the mail.
>
> Tried addying another field after Comment and then it just added that one
> and not comment. How do I make it pick up all of the saved fields?
>
> Cheers Shona
>
>



 
Reply With Quote
 
Shona
Guest
Posts: n/a
 
      9th Feb 2004
Cracked it thanks very much indeed

Cheers Shona

"Jon" <(E-Mail Removed)> wrote in message
news:u#(E-Mail Removed)...
> strBody = "Dear " & FP_SavedFields("Name") & VbCrLf
> strBody = strBody & FP_SavedFields("Comment") & VbCrLf
> and then
> .TextBody = strBody
>



 
Reply With Quote
 
Shona
Guest
Posts: n/a
 
      9th Feb 2004
Any chance you know where I can find the script to put a button on the page
which prints the page do you?

Thanks again Shona

"Shona" <(E-Mail Removed)> wrote in message
news:c08bpn$3r3$(E-Mail Removed)...
> Cracked it thanks very much indeed
>
> Cheers Shona
>
> "Jon" <(E-Mail Removed)> wrote in message
> news:u#(E-Mail Removed)...
> > strBody = "Dear " & FP_SavedFields("Name") & VbCrLf
> > strBody = strBody & FP_SavedFields("Comment") & VbCrLf
> > and then
> > .TextBody = strBody
> >

>
>



 
Reply With Quote
 
Jon
Guest
Posts: n/a
 
      9th Feb 2004
Hi,
<form>
<input type="button" onclick="if(window.print)window.print();" value="Print
It">
</form>

Jon

"Shona" <(E-Mail Removed)> wrote in message
news:c08bu3$453$(E-Mail Removed)...
> Any chance you know where I can find the script to put a button on the

page
> which prints the page do you?
>
> Thanks again Shona
>
> "Shona" <(E-Mail Removed)> wrote in message
> news:c08bpn$3r3$(E-Mail Removed)...
> > Cracked it thanks very much indeed
> >
> > Cheers Shona
> >
> > "Jon" <(E-Mail Removed)> wrote in message
> > news:u#(E-Mail Removed)...
> > > strBody = "Dear " & FP_SavedFields("Name") & VbCrLf
> > > strBody = strBody & FP_SavedFields("Comment") & VbCrLf
> > > and then
> > > .TextBody = strBody
> > >

> >
> >

>
>



 
Reply With Quote
 
Shona
Guest
Posts: n/a
 
      10th Feb 2004
Excellent thank you very much

Shona
"Jon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
> <form>
> <input type="button" onclick="if(window.print)window.print();"

value="Print
> It">
> </form>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing a macro/script whenevera document is saved srinathava Microsoft VB .NET 0 27th Oct 2008 03:35 PM
Selecting Saved Fields TedS Microsoft Frontpage 1 19th May 2008 04:18 AM
Overwrite saved workbook in VB Script Martin X. Microsoft Excel Programming 2 13th Aug 2007 03:46 PM
Customized Fields not saved =?Utf-8?B?VGluY3Vw?= Microsoft Outlook BCM 1 23rd Feb 2007 06:58 PM
Thousands of emails when running an asp script using CDONTS Ricky T Microsoft Windows 2000 1 1st Sep 2003 03:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:18 PM.