Hi,I am trying to send an email from my application, including a doclink.
Unfortunately, it appears @MailSend only allows 255 characters.
So I am using script to send the email.
Basically, it works, BUT the text and the document link are literally ‘appended’ to the email, e.g. at the end.
Most people in our company use email ‘signatures’. I want the Text and the doclink to appear BEFORE the signature, not AFTER the signature, that just looks silly and is inconvinient.
Heres the code:-
Sub Initialize
Dim memo As NotesDocument
Dim rtitem As NotesRichTextItem
Dim object As NotesEmbeddedObject
Dim ws As New NotesUIWorkspace
Dim MailServer As String
Dim MailFile As String
Dim MailDB As NotesDatabase
Dim ses As NotesSession
Dim g_thisDB As NotesDatabase
Dim tMsg As String
Dim tMsgTitle As String
Dim Doc As NotesDocument
Dim db As NotesDatabase
Set ses = New NotesSession
Set g_thisDB = ses.CurrentDatabase
Set db = ses.CurrentDatabase
'Get mail file information from Location document using Notes.ini
MailServer = ses.GetEnvironmentString( "MailServer",True)
MailFile = ses.GetEnvironmentString( "MailFile",True)
'Attempt to open local mail file
Set MailDB = New NotesDatabase("", MailFile)
If Not MailDB.IsOpen Then
'Attempt to open server replica of mail file
Set MailDB = New NotesDatabase(MailServer, MailFile)
If Not MailDB.IsOpen Then
Msgbox "An error occured opening your Mail File.",16, "Notice"
Exit Sub
End If
End If
'This new code should create an email in the users Mailbox
Set memo = MailDB.CreateDocument
' Note: If this sub is called by a server agent, the From field gets replaced by the ID that signed the agent
memo.Form = "Memo"
memo.From = ses.UserName
memo.SendTo = "Someone@SomeCompany.Com"
memo.CopyTo = ""
memo.BlindCopyTo = ""
memo.Subject = "3M Price Quote "
' can include code like this & doc.OurRef(0) on the above line to include things
'from the document
'May need a little customisation to do this e.g. may need to Set doc
'reply.Subject = "Re: " & memo.Subject( 0 )
' Create the body field for the memo
Set rtitem = memo.CreateRichTextItem("Body")
'Call rtitem.AddNewLine(1)
Call rtitem.AppendText("Heres some example text, hard coded")
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
Set Doc = uidoc.Document
Call rtitem.AppendDocLink( doc, db.Title )
'Dim file As NotesRichTextItem
'Set file = doc.GetFirstItem( "QuoteAsAttachment" )
'Call rtitem.AppendRTItem(file)
' Append file attachment rtf field to the body of the memo
'Call rtitem.AddNewLine(1)
'If (rtitem_lkup.Type <> ERRORITEM) Then 'Verify item is not an error
'Call rtitem.AppendRTItem(rtitem_lkup)
'End If
'Open memo in the UI
Call memo.ComputeWithForm(True, False)
Call ws.EditDocument(True, memo)
'Send the memo - OLD - SENDS DIRECTLY!!
'Call memo.Send(False)
End Sub