| Email to Internet Mail via LotusScript |
Tripp W Black on 08/26/1999 at 07:51 PM |
Category: Notes Developer Tips
Forms/Subforms, LotusScript
|
Author:
Ruediger Seiffert
Date:
Thursday, 1/28/99 5:10 PM EST
Subject:
Re: Help. Agent to kick off email after web post
Hi,
ok, you can "steal" the following:
I suppose you have a flag in your faq-document which will be set if itīs answered
(faq_answered="true").
Create another flag which will prevent multiple sending of the same message:
Field (editable - hidden):
email_already_sent
Default Value: "false"
Then put the following in the documents QueryClose-Event
Sub QueryClose(Source As Notesuidocument, Continue As Variant)
Dim doc as NotesDocument
Dim var1 As String
...
Dim varN As String
Set doc = source.Document
var1 = doc.Field1(0)
...
If doc.faq_answered(0)="true" and doc.email_already_sent(0)="false" Then
Call SentNotification(var1, ..., varN, Mailaddress)
doc.email_already_sent(0)="true" <---- This prevents multiple EMail-Notifications
Call doc.Save(True, False) <---- I donīt know if this is necessary for QueryClose - test it ;-)
End If
End Sub
And this is your SUB:
Sub SentNotification(Subvar1 As String, ...., SubvarN As String, EMail As String) ' <---- Define the
variables you need in the same order then you give them to this Sub
Dim s As New NotesSession
Dim mail As New NotesDocument(s.CurrentDatabase)
mail.subject = "Your subject goes here..." <--- You can create "Copy", "BlindCopy" etc. in the same
manner
Dim rtitem As New NotesRichTextItem(mail,"Body")
Call rtitem.AppendText("Bla Bl Bla " & UName & "!")
Call rtitem.AddNewLine(1)
Call rtitem.AppendText("More and more Text")
Call rtitem.AddNewLine(1)
......
......
Call mail.Send( False, EMail )
End Sub
One thing to mention:
The above method does not save the sent messsage. If you need it to be saved you have to modify
the script.
Hope this helps
Ruediger
rseiffert@change-it.de
previous page
|