David
|
| Posted: 02/27/2003, 2:46 PM |
|
I'm using the TaskMan application (VB/ASP) and trying to make the "update" function within the task record send an email.
The email should pick up the details of the address from the "assigned to" user list? (the "assigned to" employee name and email address is stored in the employees table)
Many Thanks
David
|
|
|
 |
rrodgers
|
| Posted: 02/27/2003, 4:17 PM |
|
This is some code that notifies me when someone adds a contact request. This works on Insert for a table that has an Identity column. It is in the AfterExecuteInsert event. If you also want to do it on update you will need to put code like this in the afterupdate event. And know the values for the primary key.
rob
Dim rsIdent
Dim rs
Dim NewIdent
Dim sBody
Dim objNewMail
Dim sSQL
Dim DirectLinkURL
Dim SystemEmail
Dim ToEmail
Set rsIdent = DBSCConnection.Execute("SELECT @@IDENTITY As intIdent")
If Not rsIdent.EOF Then
NewIdent = CCGetValue(rsIdent,"intIdent")
' If NewIdent > 0 Then
'@@@@@@@@@
ToEmail = ""' GET THIS FROM A TABLE OR HARD CODE IF you Like.
SystemEmail = "system@yoururl.com"
DirectLinkURL = "http://www.yoururl.com/clients/"
sSQL = "SELECT * from scclnt_Email "
sSQL = sSQL & "Where EmailSysID = " & NewIdent
Set rs = DBSCConnection.Execute(sSQL)
If Not rs.EOF Then
If Right(DirectLinkURL,1) <> "/" Then
DirectLinkURL = DirectLinkURL & "/"
End IF
sBody = "DirectLink: " & DirectLinkURL & "viewemail.asp?emailsysid=" & NewIdent & vbCRLF & vbCRLF
sBody = sBody & "To: " & CCGetValue(rs,"ToName") & vbCRLF
sBody = sBody & "Product: " & CCGetValue(rs,"Product") & vbCRLF
sBody = sBody & "From: " & CCGetValue(rs,"FromName") & vbCRLF
sBody = sBody & "Subject: " & CCGetValue(rs,"Subject") & vbCRLF
sBody = sBody & "Body: " & vbCRLF & CCGetValue(rs,"Body")
Set objNewMail = CreateObject("CDONTS.NewMail")
With objNewMail
.From = SystemEmail
.To = ToEmail
.Subject = "New Web Site Email"
.Body = sBody
.BodyFormat = 1
.MailFormat = 0
.Send
End With
Set objNewMail = Nothing ' canNOT reuse it for another message
End If
rs.Close
Set rs = Nothing
End IF
rsIdent.Close
Set rsIdent = Nothing
|
|
|
 |
|