L
laofuzi
Unregistered / Unconfirmed
GUEST, unregistred user!
我用的是indy控件中的idsmtp和idmessage想实现smtp发信,结果不行,我可是完全模仿的demo中的例子呀.请各位大虾指点.我把源程序贴在下面.(一定给分!!!!!!!!!)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, IdMessage, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdMessageClient, IdSMTP;
type
TForm1 = class(TForm)
smtp: TIdSMTP;
mail: TIdMessage;
Label1: TLabel;
edtHost: TEdit;
Label2: TLabel;
edtUser: TEdit;
Label3: TLabel;
edtPassword: TEdit;
Label4: TLabel;
edtPort: TEdit;
Label5: TLabel;
edtTo: TEdit;
Label6: TLabel;
edtSubject: TEdit;
Label7: TLabel;
edtFrom: TEdit;
memBody: TMemo;
Label8: TLabel;
Button1: TButton;
chkSmtp: TCheckBox;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
mail.Body.Assign(memBody.Lines);
mail.From.Text:=edtFrom.Text ;
mail.ReplyTo.EMailAddresses :=edtFrom.Text ;
mail.Subject :=edtSubject.Text ;
if chkSmtp.Checked then
smtp.AuthenticationType :=atLogin
else
smtp.AuthenticationType :=atNone;
smtp.Username :=edtUser.Text ;
smtp.Password :=edtPassword.Text ;
smtp.Host :=edtHost.Text ;
smtp.Port :=StrToInt(edtPort.text);
smtp.Connect ;
try
smtp.Send(mail);
finally
smtp.Disconnect ;
end;
end;
end.
运行后总是出现503error:need RCPT command;
请问如何解决?急......
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, IdMessage, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdMessageClient, IdSMTP;
type
TForm1 = class(TForm)
smtp: TIdSMTP;
mail: TIdMessage;
Label1: TLabel;
edtHost: TEdit;
Label2: TLabel;
edtUser: TEdit;
Label3: TLabel;
edtPassword: TEdit;
Label4: TLabel;
edtPort: TEdit;
Label5: TLabel;
edtTo: TEdit;
Label6: TLabel;
edtSubject: TEdit;
Label7: TLabel;
edtFrom: TEdit;
memBody: TMemo;
Label8: TLabel;
Button1: TButton;
chkSmtp: TCheckBox;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
mail.Body.Assign(memBody.Lines);
mail.From.Text:=edtFrom.Text ;
mail.ReplyTo.EMailAddresses :=edtFrom.Text ;
mail.Subject :=edtSubject.Text ;
if chkSmtp.Checked then
smtp.AuthenticationType :=atLogin
else
smtp.AuthenticationType :=atNone;
smtp.Username :=edtUser.Text ;
smtp.Password :=edtPassword.Text ;
smtp.Host :=edtHost.Text ;
smtp.Port :=StrToInt(edtPort.text);
smtp.Connect ;
try
smtp.Send(mail);
finally
smtp.Disconnect ;
end;
end;
end.
运行后总是出现503error:need RCPT command;
请问如何解决?急......