![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Почта через IdSMTP [D7, WinXP]
Kelvin © (2004-01-29 15:28:00)Обясните плз. как отправить письмо с помощью IdSMTP, а то что то не получается :(
AVGVI (2004-03-02 00:14:00) [1]TIdAttachment.Create(MessageParts,FileName);
asterisk (2004-03-01 19:32:00) [2]А как приатачить файлик?
ALF (2004-03-01 02:51:00) [3]А как тогда код с аутентификацией? Не просто же надо строки раскомментировать?
csr (2004-01-30 11:26:00) [4]Ну вот тебе простейшая процедура. А ваще самому нада с этим разбираться, т.к. это элементарно :).
uses
IdSMTP, IdMessage;
procedure SendMail(ASMTPHost, AFrom, ATo, AReplyTo, ASubject: string;
APriority: Integer; ACc, ABcc, Content: string; AWithRecipient: Boolean);
var
MsgSend: TIdMessage;
SMTP: TIdSMTP;
begin
MsgSend := TIdMessage.Create(nil);
SMTP := TIdSMTP.Create(nil);
try
with MsgSend do
begin
Body.Text := Content;
From.Text := AFrom;
ReplyTo.EMailAddresses := AReplyTo;
Recipients.EMailAddresses := ATo; { To: header }
Subject := ASubject; { Subject: header }
Priority := TIdMessagePriority(APriority); { Message Priority }
CCList.EMailAddresses := ACc; {CC}
BccList.EMailAddresses := ABcc; {BBC}
if AWithRecipient then
ReceiptRecipient.Text := From.Text {We set the recipient to the From E-Mail address }
else
ReceiptRecipient.Text := ''; {indicate that there is no receipt recipiant}
end;
SMTP.AuthenticationType := atNone;
//SMTP.Username := SmtpServerUser;
//SMTP.Password := SmtpServerPassword;
{General setup}
SMTP.Host := ASMTPHost;
SMTP.Port := 25;
{now we send the message}
SMTP.Connect;
try
SMTP.Send(MsgSend);
finally
SMTP.Disconnect;
end;
finally
MsgSend.Free();
SMTP.Free();
end;
end;
Palladin (2004-01-29 15:55:00) [5]Ну а где же то что не получается?