Bonjour à tous,

J'ai un code d'envoi de mail via Lotus qui fonctionne très bien, y compris avec des pièces jointes.

Mais je n'arrive pas à envoyer le mail avec mon fichier html de signature, qui se charge automatiquement lors d'un envoi manuel sous Lotus.

J'ai essayé de rédiger du html directement dans le corps de mon mail mais sans succès non plus, il n'interprete pas le code HTML.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
 
Sub envoiMail(mailAddress As String, subject As String)
 
    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)
    'Start a session to notes
    Set Session = CreateObject("Notes.NotesSession")
    'Get the sessions username and then calculate the mail file name
    'You may or may not need this as for MailDBname with some systems you
    'can pass an empty string
    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 up the new mail document
    Set MailDoc = Maildb.CREATEDOCUMENT
    MailDoc.Form = "Memo"
    MailDoc.Sendto = mailAddress '(laisse les "")
    MailDoc.CopyTo = "" '(laisse les "")
    MailDoc.subject = subject '(avec des "")
    ' Construction du corps du message
 
    Set objNotesField = MailDoc.CREATERICHTEXTITEM("Body")
 
    entete = "<style type='text/css'>" & _
            "body, .txtnormal { font-family: sans-serif, Arial, Helvetica; font-size: 10pt; }" & _
            ".orange { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: #ff8100; }" & _
            ".orangegras { font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; color: #ff8100; }" & _
            ".orangegraspetit { font-family: Arial, Helvetica, sans-serif; font-size: 9px; font-weight: bold; color: #ff8100; }" & _
            ".bleugras,.bleugras a { font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; color: #0062e1; text-decoration:none; }" & _
            ".bleugraspetit,{ font-family: Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; color: #0062e1; text-decoration:none; }" & _
            ".bleu {font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: normal; color: #0062e1; }" & _
            ".marron {font-family: Arial, Helvetica, sans-serif; font-size: 10px; font-weight: normal; color: #766958; }" & _
            ".interligne { font-family: sans-serif, Arial, Helvetica; font-size: 2pt; font-weight:normal; color: #0062e1;}" & _
            ".msgdd { font-family:Arial, Helvetica, sans-serif; font-size: 7pt; font-weight:normal; color: #0062e1;}" & _
            ".margeT { font-size: 12px; }</style>"
 
    signature = "<span class='orangegras'> blabla</span><br>" & _
                "<span class='marron'> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; blabla</span><br>" & _
                "<br><span class='bleu'>  blabla<br></span>" & _
                "<span class='bleu'> blabla<br></span>" & _
                "<span class='interligne'>&nbsp;<br></span>" & _
                "<div class='bleugras'> blabla</div>" & _
                "<span class='bleu'> blabla<br></span>"
 
    With objNotesField
        .AppendText "Bonjour,"
        .AddNewLine 2
        .AppendText "Ci-joint la situation." 
        .AddNewLine 2
        .AppendText "Cordialement"
        .AddNewLine 1
        .AppendText entete & signature
        .AddNewLine 3
    End With
    MailDoc.SaveMessageOnSend = True
 
 
 
    Sheets("blabla").Copy
    ChDir "C:\TEMP"
    blabla = "blabla-" & Year(Date) & "-" & Month(Date) & "-" & Day(Date)
    NomFichier = "C:\TEMP\" & blabla & ".xls"
    nomfichier2 = blabla & ".xls"
    ActiveWorkbook.SaveAs Filename:= _
    NomFichier, FileFormat:= _
    xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
    , CreateBackup:=False
 
    Attachment = Workbooks(nomfichier2).FullName
    Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment1")
    Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment1")
 
 
 
    MailDoc.SEND (False)
 
    Workbooks(nomfichier2).Close
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(NomFichier)
    f.Delete
 
    MsgBox "Mail " & subject & " envoyé le " & Date & " avec succès !"
 
 
    'Set up the embedded object and attachment and attach it
End Sub