bonjour, j'essai l'envoi d'email en utilisant un smtp de gmail
mais quand j'envoi un mail je reçois le mail de google suivant :
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 procedure Gmail(username, password, totarget, subject, body: string); var DATA: TIdMessage; SMTP: TIdSMTP; SSL: TIdSSLIOHandlerSocketOpenSSL; begin SMTP := TIdSMTP.Create(nil); DATA := TIdMessage.Create(nil); SSL := TIdSSLIOHandlerSocketOpenSSL.Create(nil); SSL.SSLOptions.Method := sslvTLSv1; SSL.SSLOptions.Mode := sslmUnassigned; SSL.SSLOptions.VerifyMode := []; SSL.SSLOptions.VerifyDepth := 0; DATA.From.Address := username; DATA.Recipients.EMailAddresses := totarget; DATA.subject := subject; DATA.body.text := body; SMTP.IOHandler := SSL; SMTP.Host := 'smtp.gmail.com'; SMTP.username := username; SMTP.password := password; SMTP.Port := 587; SMTP.UseTLS := utUseExplicitTLS; SMTP.Connect; SMTP.Send(DATA); SMTP.Disconnect; SMTP.Free; DATA.Free; SSL.Free; end;
si je click sur le lien "accordant l'accès aux applications maoins sécurisées" et que je click oui,
le prochain envoi marche...
y'a un moyen pour que ça marche sans devoir activer cette option ?
merci
Partager