Help with CDO

S

SS

Hi

I know I posted before on this but I'm still having problems so if anyone
can help that would be really great. I didn't have problems with CDONTs so
why oh why did they decide to depreceate it !

I have this script which sends the mail but only for one field how do I get
it to do both. There will be others but I've tried to keep this simple for
now. It would help to be able to do this but then I also need to email the
information from dropdown boxes and checkboxes so any information here would
also be great.


<% Option Explicit %>
<%
'Declare variables
Dim sMsg
Dim sTo
Dim sFrom
Dim sSubject
Dim sTextBody



Dim sName
Dim sstrBody
Dim sChristianName
Dim sSurname
Dim strBody
Dim sMessage


sTextBody = "ChristianName: " & Request("sChristianName") & VbCrLf
sTextBody = "Surname: " & Request("sSurname") & VbCrLf


'Only run this if it's not the first time
If Request.Form("Submit") <> "" Then

Dim objMail
'Create the mail object
Set objMail = Server.CreateObject("CDO.Message")
'Set key properties
objMail.From = "(e-mail address removed)"
objMail.To = "(e-mail address removed)"
objMail.Subject = sSubject
objMail.TextBody = sTextBody


objMail.Send



'Clean-up
Set objMail = Nothing

End If
%>
 
S

Stefan B Rusynko

You need to concatenate your variables
sTextBody = "ChristianName: " & Request("sChristianName") & VbCrLf
sTextBody = sTextBody & "Surname: " & Request("sSurname") & VbCrLf


--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Hi
|
| I know I posted before on this but I'm still having problems so if anyone
| can help that would be really great. I didn't have problems with CDONTs so
| why oh why did they decide to depreceate it !
|
| I have this script which sends the mail but only for one field how do I get
| it to do both. There will be others but I've tried to keep this simple for
| now. It would help to be able to do this but then I also need to email the
| information from dropdown boxes and checkboxes so any information here would
| also be great.
|
|
| <% Option Explicit %>
| <%
| 'Declare variables
| Dim sMsg
| Dim sTo
| Dim sFrom
| Dim sSubject
| Dim sTextBody
|
|
|
| Dim sName
| Dim sstrBody
| Dim sChristianName
| Dim sSurname
| Dim strBody
| Dim sMessage
|
|
| sTextBody = "ChristianName: " & Request("sChristianName") & VbCrLf
| sTextBody = "Surname: " & Request("sSurname") & VbCrLf
|
|
| 'Only run this if it's not the first time
| If Request.Form("Submit") <> "" Then
|
| Dim objMail
| 'Create the mail object
| Set objMail = Server.CreateObject("CDO.Message")
| 'Set key properties
| objMail.From = "(e-mail address removed)"
| objMail.To = "(e-mail address removed)"
| objMail.Subject = sSubject
| objMail.TextBody = sTextBody
|
|
| objMail.Send
|
|
|
| 'Clean-up
| Set objMail = Nothing
|
| End If
| %>
|
|
|
 
S

SS

What a star you are absolutely excellent thank you very very much can't
thank you enough.

Shona

I can now move on maybe back with dropdown and checkboxes but will
 
S

SS

Slight hitch as soon as I connect it to a database as well I get

Microsoft VBScript compilation error '800a0400'
Expected statement

Software4.asp, line 72

Option Explicit
^This is what is on line 72 <!--webbot bot="SaveDatabase"
SuggestedExt="asp" S-DataConnection="Software4" S-RecordSource="Results"
U-Database-URL="../../fpdb/Software4.mdb"
U-Confirmation-Url="Software_Confimration.asp" S-Builtin-Fields="Timestamp"
S-Builtin-DBFields="Timestamp" S-Form-Fields="sAcrobatWriter sFrontPage
sDepartment sAdd sName sComNumber sCC sRemove"
S-Form-DBFields="sAcrobatWriter sFrontPage sDepartment sAdd sName sComNumber
sCC sRemove" -->Any ideas would be great?ThanksShona
 
S

Stefan B Rusynko

See http://www.aspfaq.com/show.asp?id=2414 w/ link to http://www.aspfaq.com/show.asp?id=2151

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Slight hitch as soon as I connect it to a database as well I get
|
| Microsoft VBScript compilation error '800a0400'
| Expected statement
|
| Software4.asp, line 72
|
| Option Explicit
| ^This is what is on line 72 <!--webbot bot="SaveDatabase"
| SuggestedExt="asp" S-DataConnection="Software4" S-RecordSource="Results"
| U-Database-URL="../../fpdb/Software4.mdb"
| U-Confirmation-Url="Software_Confimration.asp" S-Builtin-Fields="Timestamp"
| S-Builtin-DBFields="Timestamp" S-Form-Fields="sAcrobatWriter sFrontPage
| sDepartment sAdd sName sComNumber sCC sRemove"
| S-Form-DBFields="sAcrobatWriter sFrontPage sDepartment sAdd sName sComNumber
| sCC sRemove" -->Any ideas would be great?ThanksShona
|
|
 
S

SS

Thanks for this but I think I'm OK now. I've managed to get CDONTs to work
fine in the past and then just a shot in the dark I decided to change the
line

Set objCDOMail = Server.CreateObject("CDONTS.NewMail")

to

Set objCDOMail = Server.CreateObject("CDO.Message")

and hey presto it all works and I've spent a whole week trying to write it
all from scratch !

Please confirm that this is correct?

Cheers Shona
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top