J'ai suivi à la lettre ce qui est écrit ici et voici ma forme en texte :

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
object Form8: TForm8
  Left = 0
  Top = 0
  Caption = 'Form8'
  ClientHeight = 242
  ClientWidth = 527
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object btn1: TButton
    Left = 232
    Top = 128
    Width = 75
    Height = 25
    Caption = 'btn1'
    TabOrder = 0
    OnClick = btn1Click
  end
  object IdSMTP1: TIdSMTP
    IOHandler = IdSSLIOHandlerSocketOpenSSL1
    Host = 'smtp.gmail.com'
    Password = 'monMDP'
    Port = 587
    SASLMechanisms = <>
    UseTLS = utUseExplicitTLS
    Username = 'moi'
    Left = 96
    Top = 56
  end
  object IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL
    Destination = 'smtp.gmail.com:587'
    Host = 'smtp.gmail.com'
    MaxLineAction = maException
    Port = 587
    DefaultPort = 0
    SSLOptions.Mode = sslmUnassigned
    SSLOptions.VerifyMode = []
    SSLOptions.VerifyDepth = 0
    Left = 264
    Top = 32
  end
  object IdMessage1: TIdMessage
    AttachmentEncoding = 'UUE'
    BccList = <>
    CCList = <>
    Encoding = meDefault
    FromList = <
      item
        Address = 'monmail@gmail.com'
        Text = 'monmail@gmail.com'
        Domain = 'gmail.com'
        User = 'moi'
      end>
    From.Address = 'monmail@gmail.com'
    From.Text = 'monmail@gmail.com'
    From.Domain = 'gmail.com'
    From.User = 'moi'
    ReceiptRecipient.Address = 'monmail@gmail.com'
    ReceiptRecipient.Text = 'monmail@gmail.com'
    ReceiptRecipient.Domain = 'gmail.com'
    ReceiptRecipient.User = 'moi'
    Recipients = <
      item
        Address = 'monmail@gmail.com'
        Text = 'monmail@gmail.com'
        Domain = 'gmail.com'
        User = 'moi'
      end>
    ReplyTo = <>
    Sender.Address = 'monmail@gmail.com'
    Sender.Text = 'monmail@gmail.com'
    Sender.Domain = 'gmail.com'
    Sender.User = 'moi'
    ConvertPreamble = True
    Left = 424
    Top = 40
  end
end
en exécutant pas à pas le programme, l'erreur Connection Closed Gracefuly est déclenchée à la ligne en rouge de l'unité IdSMTPBase:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
procedure TIdSMTPBase.Send(AMsg: TIdMessage);
var
  LRecipients: TIdEMailAddressList;
begin
  LRecipients := TIdEMailAddressList.Create(Self);
  try
    LRecipients.AddItems(AMsg.Recipients);
    LRecipients.AddItems(AMsg.CCList);
    LRecipients.AddItems(AMsg.BccList);
    Send(AMsg, LRecipients);
  finally
    FreeAndNil(LRecipients);
  end;
end;
des idées ....