unit Main;
{SSL ist zwar schon da, aber noch auskommentiert.}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
idSmtp, idMessage, idSSLOpenSSL, StdCtrls;
type
TForm1 = class(TForm)
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
smtp: TIdSmtp;
SSLHandler: TIdSSLIOHandlerSocketOpenSSL;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
idGlobal, idExplicitTLSClientServerBase,
idAttachmentFile, idUserPassProvider,
IdSASL_CRAM_MD5, IdSASL_CRAM_SHA1, idSASLPlain,
idSASLLogin, idSASLSKey, idSASLOTP, idSASLAnonymous,
idSASLExternal;
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var
IdUserPassProvider: TIdUserPassProvider;
IdSASLCRAMMD5: TIdSASLCRAMMD5;
IdSASLCRAMSHA1: TIdSASLCRAMSHA1;
IdSASLPlain: TIdSASLPlain;
IdSASLLogin: TIdSASLLogin;
IdSASLSKey: TIdSASLSKey;
IdSASLOTP: TIdSASLOTP;
IdSASLAnonymous: TIdSASLAnonymous;
IdSASLExternal: TIdSASLExternal;
begin
smtp := TIdSmtp.Create (Application);
(*
SSLHandler := TIdSSLIOHandlerSocketOpenSSL.Create(
smtp);
SSLHandler.MaxLineAction := maException;
SSLHandler.SSLOptions.Method := sslvSSLV23;
SSLHandler.SSLOptions.Mode := sslmClient;
SSLHandler.SSLOptions.VerifyMode := [];
SSLHandler.SSLOptions.VerifyDepth := 0;
smtp.IOHandler := SSLHandler;
IdUserPassProvider := TIdUserPassProvider.Create(
SMTP);
IdUserPassProvider.Username := 'web454p1';
IdUserPassProvider.Password := 'LittleJamy16';
IdSASLCRAMSHA1 := TIdSASLCRAMSHA1.Create(
SMTP);
IdSASLCRAMSHA1.UserPassProvider := IdUserPassProvider;
IdSASLCRAMMD5 := TIdSASLCRAMMD5.Create(
SMTP);
IdSASLCRAMMD5.UserPassProvider := IdUserPassProvider;
IdSASLSKey := TIdSASLSKey.Create(
SMTP);
IdSASLSKey.UserPassProvider := IdUserPassProvider;
IdSASLOTP := TIdSASLOTP.Create(
SMTP);
IdSASLOTP.UserPassProvider := IdUserPassProvider;
IdSASLAnonymous := TIdSASLAnonymous.Create(
SMTP);
IdSASLExternal := TIdSASLExternal.Create(
SMTP);
IdSASLLogin := TIdSASLLogin.Create(
SMTP);
IdSASLLogin.UserPassProvider := IdUserPassProvider;
IdSASLPlain := TIdSASLPlain.Create(
SMTP);
IdSASLPlain.UserPassProvider := IdUserPassProvider;
SMTP.SASLMechanisms.Add.SASL := IdSASLCRAMSHA1;
SMTP.SASLMechanisms.Add.SASL := IdSASLCRAMMD5;
SMTP.SASLMechanisms.Add.SASL := IdSASLSKey;
SMTP.SASLMechanisms.Add.SASL := IdSASLOTP;
SMTP.SASLMechanisms.Add.SASL := IdSASLAnonymous;
SMTP.SASLMechanisms.Add.SASL := IdSASLExternal;
SMTP.SASLMechanisms.Add.SASL := IdSASLLogin;
SMTP.SASLMechanisms.Add.SASL := IdSASLPlain;
*)
smtp.host := 'webbox222.server-home.org';
smtp.port := 25; //587;
smtp.username := 'Bla';
smtp.password := 'Bla';
smtp.authtype := satDefault; // satSASL
//
smtp.UseTLS := utUseImplicitTLS;
smtp.connect;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
m: TIdMessage;
begin
m := TIdMessage.create (Application);
m.clear;
m.from.name := 'Marco';
m.from.address := 'info@l-becker.de';
M.Recipients.EMailAddresses := 'mo@stonesbrook-ranch.de';
m.subject := 'Testmail';
m.body.text := 'This is a very great test mail!';
// if fDateiname <> '' then
// TIdAttachmentFile.Create (m.MessageParts, fDateiname);
if
smtp.connected then
smtp.send (m);
m.free;
end;
end.