Bonjour
En essayant d'envoyer un mail depuis mon application depuis bientôt une semaine j'ai plusieurs problèmes, actuellement "Could not load SSL library" alors que j'ai suivi les instructions et mis les deux librairies dans le répertoire de l'application et dans le répertoire SYSTEM32 de Windows,
Aussi j'ai essayé avec toutes les OpenSSL que j'ai de la version 0.96 a la 1.00D
Rien n'y fait.
Quelqu'un pourrait il me dire ou se trouve l'erreur :
Ci dessous les sources de mon exemple :
SMINDY32.dpr
UMain.pas
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 Program SMINDY32; Uses Forms, UMain In 'UMain.pas' {FMain}; {$R *.res} Begin Application.Initialize; Application.CreateForm(TFMain,FMain); Application.Run; End.
UMain.dfm
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101 Unit UMain; Interface Uses Windows,Forms,SysUtils,IdIOHandler,IdIOHandlerSocket,IdIOHandlerStack,IdSSL,IdSSLOpenSSL,IdMessage,IdBaseComponent,IdComponent,IdTCPConnection,IdTCPClient,IdExplicitTLSClientServerBase,IdMessageClient,IdSMTPBase,IdSMTP,ComCtrls,StdCtrls,Controls,Classes; Type TFMain=Class(TForm) EDPAS:TEdit; EDUSR:TEdit; EDPOR:TEdit; EDSUB:TEdit; EDHOS:TEdit; EDTOO:TEdit; EDFRO:TEdit; EDHEL:TEdit; MMBOD:TMemo; LBPOR:TLabel; LBUSR:TLabel; LBPAS:TLabel; LBHOS:TLabel; LBAUT:TLabel; LBBOD:TLabel; LBSUB:TLabel; LBDAT:TLabel; LBPRI:TLabel; LBFRO:TLabel; LBTOO:TLabel; LBTLS:TLabel; LBHEL:TLabel; BTSEN:TButton; ISMTP:TIdSMTP; CBTLS:TComboBox; CBPRI:TComboBox; CBAUT:TComboBox; CBUEH:TCheckBox; CBPIP:TCheckBox; GBMSG:TGroupBox; GBSMT:TGroupBox; IDMSG:TIdMessage; EDDAT:TDateTimePicker; IDSSL:TIdSSLIOHandlerSocketOpenSSL; Procedure BTSENClick(Sender:TObject); End; Var FMain:TFMain; Implementation {$R *.dfm} Procedure TFMain.BTSENClick(Sender:TObject); Begin With IDMSG Do Begin From.Address:=EDFRO.Text; ReceiptRecipient.Address:=EDTOO.Text; Subject:=EDSUB.Text; Body:=MMBOD.Lines; Case CBPRI.ItemIndex Of 0: Priority:=MPHigh; 1: Priority:=MPHighest; 2: Priority:=MPLow; 3: Priority:=MPLowest; 4: Priority:=MPNormal; End; Date:=EDDAT.Date; End; With ISMTP Do Begin Host:=EDHOS.Text; Port:=StrToInt(EDPOR.Text); Username:=EDUSR.Text; Password:=EDPAS.Text; Case CBAUT.ItemIndex Of 0: AuthType:=ATDefault; 1: AuthType:=ATSASL; 2: AuthType:=ATNone; End; Case CBTLS.ItemIndex Of 0: UseTLS:=UTUseExplicitTLS; 1: UseTLS:=UTUseImplicitTLS; 2: UseTLS:=UTUseRequireTLS; 3: Begin UseTLS:=UTNoTLSSupport; ISMTP.IOHandler:=Nil; End; End; UseEhlo:=CBUEH.Checked; PipeLine:=CBPIP.Checked; Connect; // SendCMD('STARTTLS',-1); Send(IDMSG); Disconnect; End; End; End.
Voila mon environnement : Delphi 7 Pro - Indy 10 - Open SSL 1.00 D
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537 object FMain: TFMain Left = 289 Top = 150 Width = 478 Height = 405 Caption = 'Send E-Mail with Indy' Color = 15921906 Font.Charset = ANSI_CHARSET Font.Color = clBlack Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False Position = poScreenCenter PixelsPerInch = 96 TextHeight = 13 object BTSEN: TButton Left = 385 Top = 349 Width = 75 Height = 21 Caption = '&Send' TabOrder = 0 OnClick = BTSENClick end object GBSMT: TGroupBox Left = 0 Top = 0 Width = 470 Height = 130 Align = alTop Caption = ' TIDSmtp ' TabOrder = 1 object LBPOR: TLabel Left = 40 Top = 48 Width = 27 Height = 13 Caption = 'Port :' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object LBUSR: TLabel Left = 12 Top = 73 Width = 55 Height = 13 Caption = 'Username :' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object LBPAS: TLabel Left = 14 Top = 98 Width = 53 Height = 13 Caption = 'Password :' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object LBHOS: TLabel Left = 38 Top = 23 Width = 29 Height = 13 Caption = 'Host :' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object LBAUT: TLabel Left = 230 Top = 23 Width = 57 Height = 13 Caption = 'Auth Type :' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object LBTLS: TLabel Left = 242 Top = 48 Width = 45 Height = 13 Caption = 'Use TLS :' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object LBHEL: TLabel Left = 229 Top = 73 Width = 58 Height = 13 Caption = 'Helo Name :' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object EDPAS: TEdit Left = 70 Top = 95 Width = 150 Height = 21 BevelInner = bvLowered BevelKind = bkSoft BevelOuter = bvNone BorderStyle = bsNone Color = clWhite Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False PasswordChar = '*' TabOrder = 0 end object EDUSR: TEdit Left = 70 Top = 70 Width = 150 Height = 21 BevelInner = bvLowered BevelKind = bkSoft BevelOuter = bvNone BorderStyle = bsNone Color = clWhite Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False TabOrder = 1 end object EDPOR: TEdit Left = 70 Top = 45 Width = 50 Height = 21 BevelInner = bvLowered BevelKind = bkSoft BevelOuter = bvNone BorderStyle = bsNone Color = clWhite Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False TabOrder = 2 Text = '465' end object EDHOS: TEdit Left = 70 Top = 20 Width = 150 Height = 21 BevelInner = bvLowered BevelKind = bkSoft BevelOuter = bvNone BorderStyle = bsNone Color = clWhite Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False TabOrder = 3 Text = 'smtp.gmail.com' end object EDHEL: TEdit Left = 290 Top = 70 Width = 110 Height = 21 BevelInner = bvLowered BevelKind = bkSoft BevelOuter = bvNone BorderStyle = bsNone Color = clWhite Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False TabOrder = 4 end object CBTLS: TComboBox Left = 290 Top = 45 Width = 110 Height = 21 BevelInner = bvLowered BevelKind = bkSoft BevelOuter = bvNone Style = csDropDownList Color = clWhite Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ItemHeight = 13 ItemIndex = 0 ParentFont = False TabOrder = 5 Text = 'Use Explicit TLS' Items.Strings = ( 'Use Explicit TLS' 'Use Implicit TLS' 'Use Require TLS' 'No TLS Support') end object CBAUT: TComboBox Left = 290 Top = 20 Width = 110 Height = 21 BevelInner = bvLowered BevelKind = bkSoft BevelOuter = bvNone Style = csDropDownList Color = clWhite Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ItemHeight = 13 ItemIndex = 0 ParentFont = False TabOrder = 6 Text = 'Default' Items.Strings = ( 'Default' 'SASL' 'None') end object CBUEH: TCheckBox Left = 290 Top = 100 Width = 67 Height = 17 Caption = 'Use EHLO' Checked = True Color = 15921906 Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentColor = False ParentFont = False State = cbChecked TabOrder = 7 end object CBPIP: TCheckBox Left = 380 Top = 100 Width = 57 Height = 17 Caption = 'Pipeline' Checked = True Color = 15921906 Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentColor = False ParentFont = False State = cbChecked TabOrder = 8 end end object GBMSG: TGroupBox Left = 0 Top = 130 Width = 470 Height = 210 Align = alTop Caption = ' TIDMessage ' TabOrder = 2 object LBBOD: TLabel Left = 36 Top = 99 Width = 31 Height = 13 Caption = 'Body :' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object LBSUB: TLabel Left = 24 Top = 72 Width = 43 Height = 13 Caption = 'Subject :' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object LBPRI: TLabel Left = 296 Top = 22 Width = 41 Height = 13 Caption = 'Priority :' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object LBFRO: TLabel Left = 36 Top = 22 Width = 31 Height = 13 Caption = 'From :' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object LBTOO: TLabel Left = 48 Top = 47 Width = 19 Height = 13 Caption = 'To :' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object LBDAT: TLabel Left = 307 Top = 47 Width = 30 Height = 13 Caption = 'Date :' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object MMBOD: TMemo Left = 70 Top = 97 Width = 370 Height = 100 BevelInner = bvLowered BevelOuter = bvNone BorderStyle = bsNone Color = clWhite Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] Lines.Strings = ( 'EMail Sample') ParentFont = False ScrollBars = ssVertical TabOrder = 0 end object EDSUB: TEdit Left = 70 Top = 70 Width = 200 Height = 21 BevelInner = bvLowered BevelKind = bkSoft BevelOuter = bvNone BorderStyle = bsNone Color = clWhite Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False TabOrder = 1 Text = 'EMail Subject' end object CBPRI: TComboBox Left = 340 Top = 20 Width = 100 Height = 21 BevelInner = bvLowered BevelKind = bkSoft BevelOuter = bvNone Style = csDropDownList Color = clWhite Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ItemHeight = 13 ItemIndex = 4 ParentFont = False TabOrder = 2 Text = 'MPNormal' Items.Strings = ( 'MPHigh' 'MPHighest' 'MPLow' 'MPLowest' 'MPNormal') end object EDFRO: TEdit Left = 70 Top = 20 Width = 200 Height = 21 BevelInner = bvLowered BevelKind = bkSoft BevelOuter = bvNone BorderStyle = bsNone Color = clWhite Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False TabOrder = 3 end object EDTOO: TEdit Left = 70 Top = 45 Width = 200 Height = 21 BevelInner = bvLowered BevelKind = bkSoft BevelOuter = bvNone BorderStyle = bsNone Color = clWhite Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False TabOrder = 4 end object EDDAT: TDateTimePicker Left = 340 Top = 45 Width = 100 Height = 21 BevelKind = bkSoft Date = 40782.512081342590000000 Time = 40782.512081342590000000 TabOrder = 5 end end object ISMTP: TIdSMTP IOHandler = IDSSL SASLMechanisms = <> Left = 420 Top = 70 end object IDMSG: TIdMessage AttachmentEncoding = 'UUE' BccList = <> CCList = <> Encoding = meDefault FromList = < item end> Recipients = <> ReplyTo = <> ConvertPreamble = True Left = 420 Top = 270 end object IDSSL: TIdSSLIOHandlerSocketOpenSSL Destination = ':25' MaxLineAction = maException Port = 25 DefaultPort = 0 SSLOptions.Method = sslvSSLv2 SSLOptions.Mode = sslmUnassigned SSLOptions.VerifyMode = [] SSLOptions.VerifyDepth = 0 Left = 420 Top = 100 end end
PS : J'ai trouvé une source sur le net qui permet d'envoyer un email depuis GMAIL en utilisant une dll faite maison (project1.dll) qui exporte une fonction sendmail, bien qu'elle n'utilise pas de SSL j'ai correctement recu l'email, (malheureusement le source de la DLL n'est pas fourni) donc ma deuxieme question est est il possible d'utiliser le SMTP de GMAIL par exemple sans passer par le SSL ?
Partager