Bonjour,
J'ai une erreur lors d'un envoi de mail depuis Access 2007 via GMAIL.
Apparemment d’après ce que je trouve ça serait du à l'autorisation des applications mois sécurisées de gmail , mais je ne trouve pas ou changer c truc !
Any idea ???
voila mon code et mon erreur
-----------------------
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 Sub SendEmailUsingGmail() On Error GoTo Err Dim NewMail As Object Dim mailConfig As Object Dim fields As Variant Dim msConfigURL As String Set NewMail = CreateObject("CDO.Message") Set mailConfig = CreateObject("CDO.Configuration") ' load all default configurations mailConfig.Load -1 Set fields = mailConfig.fields With NewMail .Subject = "Test Mail" .From = "francois.xxxx@gmail.com" .To = "destinataire@yahoo.fr" ' mettre ; entre chaque adresse mail ' .CC = "" ' .BCC = "" .TextBody = "Test envoi" .HTMLBody = "Write your complete HTML Page" '.AddAttachment "C:\Users\Michel\Downloads\test.xlsx" End With msConfigURL = "http://schemas.microsoft.com/cdo/configuration" With fields 'Enable SSL Authentication .Item(msConfigURL & "/smtpusessl") = True 'Make SMTP authentication Enabled=true (1) .Item(msConfigURL & "/smtpauthenticate") = 1 'Set the SMTP server and port Details .Item(msConfigURL & "/smtpserver") = "smtp.gmail.com" .Item(msConfigURL & "/smtpserverport") = 465 .Item(msConfigURL & "/sendusing") = 2 'Set your credentials of your Gmail Account .Item(msConfigURL & "/sendusername") = "francois.xxxxx@gmail.com" .Item(msConfigURL & "/sendpassword") = "mon_mot_de_passe" 'Update the configuration fields .Update End With NewMail.Configuration = mailConfig NewMail.Send MsgBox ("OK, c'est parti !") Exit_Err: Set NewMail = Nothing Set mailConfig = Nothing End Err: Select Case Err.Number Case -2147220973 'Could be because of Internet Connection MsgBox " Could be no Internet Connection !! -- " & Err.Description Case -2147220975 'Incorrect credentials User ID or password MsgBox "Incorrect Credentials !! -- " & Err.Description Case Else 'Rest other errors MsgBox "Error occured while sending the email !! -- " & Err.Description End Select Resume Exit_Err End Sub
ERREUR
---------------------
Partager