Forums

This topic is locked

Send email upon Insert Record?

Posted 27 Feb 2003 19:52:11
1
has voted
27 Feb 2003 19:52:11 jack nimble posted:
How can I send an email with CDONTS as a result of a record being inserted. For instance, once a form is submitted, I want it to be emailed. Is there any tutorials regarding this?

Replies

Replied 27 Feb 2003 22:57:50
27 Feb 2003 22:57:50 Bec C replied:
After the insert code UD creates and before the redirect to page bit insert this:

Dim iMsg
Dim iConf
Dim Flds
Dim HTML
Dim sendto

Const cdoSendUsingPort = 2

set iMsg = CreateObject("CDO.Message"
set iConf = CreateObject("CDO.Configuration"
Set Flds = iConf.Fields

' Set the CDOSYS configuration fields to use port 25 on the SMTP server.

With Flds
.Item("schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("schemas.microsoft.com/cdo/configuration/smtpserver") = ipAddress
.Item("schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With

With iMsg
Set .Configuration = iConf
.To = " "
.From = " " ' a from email address to be inserted here
.Subject = "Your subject"
.HTMLBody = "Your message - it can contain HTML tags too"
.Send
End With


' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing


Replied 27 Feb 2003 23:58:43
27 Feb 2003 23:58:43 jack nimble replied:
Thanks for the help bex!

What is with the "schemas.microsoft.com/...."?

And can I pass particular form field data into the email as well?

Reply to this topic