RobertSims
06-14-2006, 10:41 AM
I have looked at many of the examples of CDOSYS on here; however, I think I am missing something that I need to understand in order to use it.
The below code works with no problems. The issue I am having is that it executes immediately when the page loads. How do I control *WHEN* the code should execute? I have attempted to put it in a script/function call but it still executes instantly on page load.
Thanks!
--Robert Sims
------------------------------------------------------------------------------------------------
<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows Library" -->
<!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" -->
<%
Dim ObjSendMail
Dim iConf
Dim Flds
Set ObjSendMail = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = 2
.Item(cdoSMTPServer) = "mail"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPconnectiontimeout) = 10
.Update
End With
Set ObjSendMail.Configuration = iConf
Set ObjSendMail.Configuration = iConf
ObjSendMail.To = "you@there.com"
ObjSendMail.Subject = "this is the subject"
ObjSendMail.From = "me@here.com"
' we are sending a text email.. simply switch the comments around to send an html email instead
'ObjSendMail.HTMLBody = "this is the body"
ObjSendMail.TextBody = "this is the body"
ObjSendMail.Send
Set ObjSendMail = Nothing
Set iConf = Nothing
Set Flds = Nothing
%>
------------------------------------------------------------------------------------------------
The below code works with no problems. The issue I am having is that it executes immediately when the page loads. How do I control *WHEN* the code should execute? I have attempted to put it in a script/function call but it still executes instantly on page load.
Thanks!
--Robert Sims
------------------------------------------------------------------------------------------------
<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows Library" -->
<!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" -->
<%
Dim ObjSendMail
Dim iConf
Dim Flds
Set ObjSendMail = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = 2
.Item(cdoSMTPServer) = "mail"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPconnectiontimeout) = 10
.Update
End With
Set ObjSendMail.Configuration = iConf
Set ObjSendMail.Configuration = iConf
ObjSendMail.To = "you@there.com"
ObjSendMail.Subject = "this is the subject"
ObjSendMail.From = "me@here.com"
' we are sending a text email.. simply switch the comments around to send an html email instead
'ObjSendMail.HTMLBody = "this is the body"
ObjSendMail.TextBody = "this is the body"
ObjSendMail.Send
Set ObjSendMail = Nothing
Set iConf = Nothing
Set Flds = Nothing
%>
------------------------------------------------------------------------------------------------