Вниз
Скачать: CL | DM;

не могу разобраться с IdSmtp   Найти похожие ветки 

← →
ilka ©   (2003-08-06 15:35) [0]

Привет мастерам.Я никак не могу разобраться с IdSmtp, напишите plz небольшой пример. Как(чем) заполнить поля?


← →
Е-Моё имя ©   (2003-08-06 16:02) [1]

есть стандартные наполнители

заполняешь адрес сервера, пользователя, подключаешься, отправляешь сообщение
хитростей нет


← →
Disel   (2003-08-06 16:03) [2]

var
SMTP: TIdSMTP;
IdM: TIdMessage;

...
begin
SMTP:=TIdSMTP.Create(nil);
IdM:=TIdMessage.Create(nil);
with IdM do
begin
Body.Append(text);
From.Text := FromAddress;
Recipients.EMailAddresses := ToAddress; { To }
Subject := Subject_;
CCList.EMailAddresses := CcL;
BccList.EMailAddresses := BccL;
CharSet:=Charset;
//
Priority := TIdMessagePriority(mpHighest); { Message Priority }
end;

case StrToInt(AuthType) of
0: begin
SMTP.AuthenticationType := atNone;
end;
1: begin
SMTP.AuthenticationType := atLogin; {Simple Login}
SMTP.UserId:=login;
SMTP.Password:=passward;
end;
end;

SMTP.Port:=StrToInt(port);
SMTP.Host:=host;

{now we send the message}
SMTP.Connect;

try
( IdM) var
SMTP: TIdSMTP;
IdM: TIdMessage;

...
begin
SMTP:=TIdSMTP.Create(nil);
IdM:=TIdMessage.Create(nil);
with IdM do
begin
Body.Append(text);
From.Text := FromAddress;
Recipients.EMailAddresses := ToAddress; { To }
Subject := Subject_;
CCList.EMailAddresses := CcL;
BccList.EMailAddresses := BccL;
CharSet:=Charset;
//
Priority := TIdMessagePriority(mpHighest); { Message Priority }
end;

case StrToInt(AuthType) of
0: begin
SMTP.AuthenticationType := atNone;
end;
1: begin
SMTP.AuthenticationType := atLogin; {Simple Login}
SMTP.UserId:=login;
SMTP.Password:=passward;
end;
end;

SMTP.Port:=StrToInt(port);
SMTP.Host:=host;

{now we send the message}
SMTP.Connect;

try
SMTP.Send(IdM);
finally
SMTP.Disconnect;
end;

SMTP.Free;
IdM.Free;
end;


← →
Е-Моё имя ©   (2003-08-06 16:07) [3]

во как! еще бы единственный комментарий в правильное место и обработать ошибку подключения ))


← →
ilka ©   (2003-08-06 16:24) [4]

Огромное спасибо



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.46 MB
Время: 0.014 c
14-4105
Knight
2003-09-13 21:06
2003.10.02
& n b s p ; и другие...


3-3736
Dimedrol
2003-09-12 13:45
2003.10.02
After Before Update Trigger in Firebird


3-3703
Russko
2003-09-15 11:33
2003.10.02
Сортировка в Table


1-3924
Alex21
2003-09-18 11:42
2003.10.02
Ускорение работы Excel при взаимодействии со Stringgrid


1-3883
kkostik
2003-09-18 13:47
2003.10.02
Указатель на процесс! HELP!




   Наверх