Bonjour,
J'ai une macro sur excel qui envoi des mails automatiquement aux clients et elles fonctionnent trés bien mais petit problème, les mails reçus ont pour expediteur ma boite utilisateur alors que nous avons une boite générique prévu pour les retours.
Pouvez vous me dire s'il y a une solution pour choisir l'adresse mail d'envoi ?
Ci dessous le code utilisé :
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 On Error GoTo TraiteErreur 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 attachment attachment = lefichier Set session = CreateObject("Notes.NotesSession") MailDbName = "UTILISATEUR" & ".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.Subject = "OBJET DU MAIL" MailDoc.body = "CORPS DU MAIL" MailDoc.SaveMessageOnSend = True 'PJ If attachment <> "" Then Set attachme = MailDoc.CreateRichTextItem("Attachment") Set EmbedObj = attachme.EMBEDOBJECT(1454, "", attachment, "Attachment") End If 'Send the document MailDoc.posteddate = Now() MailDoc.SEND 1, "" & adrmail Set Maildb = Nothing Set MailDoc = Nothing Set attachme = Nothing Set session = Nothing Set EmbedObj = Nothing Sheets(1).Cells(j, 9).Value = "Envoyé !!!" GoTo passeCeJ TraiteErreur: Sheets(1).Cells(j, 9).Value = "Erreur !!!" 'Clean Up Set Maildb = Nothing Set MailDoc = Nothing Set attachme = Nothing Set session = Nothing Set EmbedObj = Nothing passeCeJ:
Partager