Bonjour :
Je voulais envoyer des mails avec Gmail à partir d'Excel. J'ai trouvé un programme :
Il faut utiliser la librairie :
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 Sub send_email_via_Gmail() Dim myMail As CDO.Message Set myMail = New CDO.Message myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "stg.pao@distrame.fr" myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "MotDePasse" myMail.Configuration.Fields.Update With myMail .Subject = "Test" .From = "stg.pao@distrame.fr" .To = "stg.pao@distrame.fr" .CC = "stg.pao@distrame.fr" .BCC = "" .TextBody = "Bonjour!" '.AddAttachment "C:\Users\takyar\Desktop\email-via-gmail.txt" End With On Error Resume Next myMail.Send 'MsgBox("Mail has been sent") Set myMail = Nothing End Sub
Microsoft CDO for Windows 2000 Library
Par contre, sur mon gmail :
Qui aurait la solution pour le réaliser? Merci d'avance.
Partager