Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.04.25;
Скачать: CL | DM;

Вниз

Почта через IdSMTP   Найти похожие ветки 

 
Kelvin   (2004-01-29 15:28) [0]

Обясните плз. как отправить письмо с помощью IdSMTP, а то что то не получается :(


 
Palladin ©   (2004-01-29 15:55) [1]

Ну а где же то что не получается?


 
csr ©   (2004-01-30 11:26) [2]

Ну вот тебе простейшая процедура. А ваще самому нада с этим разбираться, т.к. это элементарно :).

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;


 
ALF   (2004-03-01 02:51) [3]

А как тогда код с аутентификацией? Не просто же надо строки раскомментировать?


 
asterisk   (2004-03-01 19:32) [4]

А как приатачить файлик?


 
AVGVI ©   (2004-03-02 00:14) [5]

TIdAttachment.Create(MessageParts,FileName);



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

Текущий архив: 2004.04.25;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.028 c
1-1081502794
Layner
2004-04-09 13:26
2004.04.25
Как раскрасить продольные строки в DBGrid разным цветом (нюанс)


3-1080335030
Vemer
2004-03-27 00:03
2004.04.25
SQL запрос без "IN" составить хочу..


3-1080716517
-SeM-
2004-03-31 11:01
2004.04.25
Бинарная логика в Firebird


4-1077532974
Alexis
2004-02-23 13:42
2004.04.25
showmessage, MessageDlg на API


1-1081531477
MaxidroM555
2004-04-09 21:24
2004.04.25
Работа с классами