为什么不能发送邮件提示:‘bad sequence of commands’
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdMessage, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP;type
TForm1 = class(TForm)
IdSMTP1: TIdSMTP;
IdMessage1: TIdMessage;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
idmessage1.Clear;
idmessage1.Subject:='daring';
idmessage1.Body.Add('test');
//idmessage1.From.Text:='[email protected]';
idmessage1.From.Address:='[email protected]';
//idmessage1.From.Name:='[email protected]';
idmessage1.Recipients.EMailAddresses:='[email protected]';
//idmessage1.ReceiptRecipient.Text:='';
idsmtp1.Host:='smtp.126.com';
idsmtp1.AuthenticationType:=atLogin;
idsmtp1.Username:='daring';
idsmtp1.Password:='*****';//邮箱密码
idsmtp1.Port:=25;
try
idsmtp1.Connect();
idsmtp1.Send(idmessage1);
showmessage('OK!');
except
showmessage('无法连接到服务器!');
exit;
end;
end;end.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdMessage, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP;type
TForm1 = class(TForm)
IdSMTP1: TIdSMTP;
IdMessage1: TIdMessage;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
idmessage1.Clear;
idmessage1.Subject:='daring';
idmessage1.Body.Add('test');
//idmessage1.From.Text:='[email protected]';
idmessage1.From.Address:='[email protected]';
//idmessage1.From.Name:='[email protected]';
idmessage1.Recipients.EMailAddresses:='[email protected]';
//idmessage1.ReceiptRecipient.Text:='';
idsmtp1.Host:='smtp.126.com';
idsmtp1.AuthenticationType:=atLogin;
idsmtp1.Username:='daring';
idsmtp1.Password:='*****';//邮箱密码
idsmtp1.Port:=25;
try
idsmtp1.Connect();
idsmtp1.Send(idmessage1);
showmessage('OK!');
except
showmessage('无法连接到服务器!');
exit;
end;
end;end.
解决方案 »
- 求教关于从数据库里调出数据在tchart上划多条线的小问题!!!谢谢大家了
- 有谁拿到了Delphi 2007 for Win32的beta了?
- 关于telnet的问题,希望大家帮忙!!!
- 关于取得汉字的unicode编码的问题
- 用过lame_enc.dll的请指教
- VOD控件源码发布,要的赶快去下哟!
- 一个字符转换问题--String->PChar和PChar->String。
- 江湖膏剂,一个关于回调函数的问题,高手请进,在线等
- 请问widestring和string怎样转换?
- ?那位能告诉我在哪里可以下载到 win32 API电子文档!!在下感激不尽!!!!!!(
- 请教一下radiogroup的横排问题,注意了我知道设置columns属性!
- 如何用delphi远程连接sql server,给出代码
idsmtp1.Authenticate;
idsmtp1.Send(idmessage1); //试试
还是错误,提示为:error:authentication failed
idsmtp1.Authenticate;