Torgeir
Thu Apr 28 08:31:51 CDT 2005
Karen Middleton wrote:
> The following code works for sending email to a Lotus Notes email
> user.
>
> Set nSession = CreateObject("Notes.NotesSession")
> 'Gets the current user's maildatabase
> Set db = nSession.GETDATABASE("","")
> Call db.OPENMAIL
> Set doc = db.CREATEDOCUMENT
> Call doc.REPLACEITEMVALUE("SendTo", "Fn Ln/SRV01/SOC@ABC.com")
> Call doc.REPLACEITEMVALUE("Subject", "Test message")
> Call doc.REPLACEITEMVALUE("Body", "Did you get it correctly")
> Call doc.SEND(False)
>
> I want to be able to send attachments like a .TXT or .XLS file
> attachment to a user.
>
> I would greatly appreciate if you could share the code to add to this
> to send a attachment file to a Notes user.
Hi
This works for me (Lotus Notes 6.5.2):
'--------------------8<----------------------
Const EMBED_ATTACHMENT = 1454
Set nSession = CreateObject("Notes.NotesSession")
'Gets the current user's mail database
Set db = nSession.GetDataBase("","")
If Not db.IsOpen = True Then
db.OpenMail
End If
Set doc = db.CreateDocument
doc.Form = "Memo"
doc.Sendto = "Fn Ln/SRV01/SOC@ABC.com"
doc.Subject = "Test message"
doc.Body = "Did you get it correctly"
'Set up the embedded object and attachment and attach it
sAttachment = "C:\test\test.txt"
Set AttachME = doc.CreateRichTextItem("Attachment")
Set EmbedObj = AttachME.EmbedObject _
(EMBED_ATTACHMENT, "", sAttachment, "Attachment")
doc.Send(False)
'--------------------8<----------------------
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx