Hi All.
Im very new to Domino Designer.
Im trying to send an email to user after a user has filled out a request form.
Once the user has filled out the request form…they will need to click on the “Save and send request” button.
I have been looking at different ways of doing so and i have come across a sample code and have tried to adapt it to get it to work for my project, but nothing seems to happen…
Can someone please help me out??
I have created an action and input the following code…
On Error Goto ErrorHandler 'Start the error handler
Dim session As New NotesSession
Dim db As NotesDatabase
Dim docMemo As NotesDocument 'The mail memo
Dim rtitemBody As NotesRichTextItem 'Rich-text field to hold the Body
Set db = session.CurrentDatabase
Set docMemo = db.CreateDocument
docMemo.Form = "Memo"
docMemo.SendTo = pSendTo
docMemo.CopyTo = pCopyTo
docMemo.BlindCopyTo = pBlindCopyTo
docMemo.Subject = pSubject
Set rtitemBody = docMemo.CreateRichTextItem("Body")
Call rtitemBody.AppendText(pBody)
If Not(pDocLink Is Nothing) Then
Call rtitemBody.AddNewLine(2)
Call rtitemBody.AppendText({Click to open the document =>})
Call rtitemBody.AppendDocLink(pDocLink, "Click to open the document")
End If
Call docMemo.Send(False)
fnSendMailWithDocLink = True
ErrorHandler:
'error occurred.
'false, because an error occured
fnSendMailWithDocLink = False
I have then put the following code into my “save and send request button”
Dim ws As New NotesUIWorkSpace
Dim doc As NotesDocument
Dim arrSendTo(0 To 1) As String
Dim arrCopyTo(0 To 1) As String
Dim arrBlindCopyTo(0 To 1) As String
Dim txtSubject As String
Dim txtBody As String
Set doc = ws.CurrentDocument.Document
'Set mail memo fields
txtSubject = {This is a test e-mail}
txtBody = {Just testing the email...}
arrSendTo(0) = {user@hotmail.com}
arrCopyTo(0) = {user@hotmail.com}
arrBlindCopyTo(0) = {user@hotmail.co.uk}
'Try sending the mail
If fnSendMailWithDocLink(doc.memoarrSendTo, doc.memoarrCopyTo, doc.memoarrBlindCopyTo, txtSubject, txtBody,doc) Then
'Success
Else
'Failure
End If
Any help will be grately apreciated…
Thanks