1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim recip(7) As Variant ' tableau des destinataires
'recip(0) = "toto@bidule.fr"
'Envoi du fichier par e-mail
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = LEFT$(UserName, 1) & _
RIGHT$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
'Open the mail database in notes
Set Maildb = Session.GetDatabase("", MailDbName)
If Maildb.IsOpen = True Then
'Already open for mail
Else
Maildb.OpenMail
End If
'Set up the new mail document
Set MailDoc = Maildb.CreateDocument
MailDoc.Form = "Memo"
MailDoc.sendto = recip 'Envoi du document à la liste de destinataires (VOIR DIM)
MailDoc.Subject = "subject"
MailDoc.SaveMessageOnSend = SaveIt
'Set up the embedded object and attachment and attach it
Attachment = FOLDER_LONG & FILE_NAME & " - " & ".pdf"
If Attachment <> "" Then
Set AttachME = MailDoc.CreateRichTextItem("Attachment")
Set EmbedObj = AttachME.EmbedObject(1454, "", Attachment, "Attachment")
MailDoc.CreateRichTextItem ("Attachment")
End If
'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.Send 0, Recipient |
Partager