![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Отправка E-Mail a Indy [D7, 2000]
XTD © (2006-08-14 16:37:00)Мой код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdMessageClient, IdSMTP, IdMessage;
type
TForm1 = class(TForm)
Button1: TButton;
IdSMTP1: TIdSMTP;
IdMessage1: TIdMessage;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var Msg: TIdMessage;
begin
IdSMTP1.Port:=25;
IdSMTP1.Host := 'smtp.mail.ru';
IdSMTP1.AuthenticationType:=atLogin;
IdSMTP1.Username:='MyLogin@mail.ru';
IdSMTP1.Password:='MyPass';
IdSMTP1.Connect(5000);
Msg.Subject:='Тема сообщения';
Msg.Recipients.EMailAddresses:='delphi@mail.ru';//Получатель
Msg.From.Address:='delphi@mail.ru';//Отправитель
Msg.Body.Text:='Текст сообщения';
Msg.Date:=StrToDate('14.08.2006');//Дата отправки
if IdSMTP1.Connected=True then IdSMTP1.Send(Msg);
IdSMTP1.Disconnect;
end;
end.
ВЫДАЕТ ОШИБКУ:
... исключение класса EAccessViolation ...
ЧТО ДЕЛАТЬ ???
XTD (2006-08-14 16:56:00) [1]Нашел! Спасибо...
XTD (2006-08-14 16:54:00) [2]... исключение класса EldProtocolReplyError ...
send address must match authenticated user
Сергей М. (2006-08-14 16:47:00) [3]nil
XTD (2006-08-14 16:46:00) [4]Msg := TIdMessage.Create(?????????);
Сергей М. (2006-08-14 16:44:00) [5]Msg := TIdMessage.Create(..); //!!!!!!!!!!!!!!!
Msg.Subject:='Тема сообщения';
...