delphi关于邮箱收信的问题


本文整理自网络,侵删。

 delphi关于邮箱收信的问题

unit Unit1;

interface

uses
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;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Label3: TLabel;
Label4: TLabel;
Edit2: TEdit;
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Edit6: TEdit;
procedure IdSMTP1Connected(Sender: TObject);
procedure IdSMTP1WorkBegin(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCountMax: Integer);
procedure IdSMTP1WorkEnd(Sender: TObject; AWorkMode: TWorkMode);
procedure IdSMTP1Disconnected(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.IdSMTP1Connected(Sender: TObject);
begin
showmessage('服务器连接成功!');
end;

procedure TForm1.IdSMTP1WorkBegin(Sender: TObject; AWorkMode: TWorkMode;
const AWorkCountMax: Integer);
begin
Showmessage('开始发信');
end;

procedure TForm1.IdSMTP1WorkEnd(Sender: TObject; AWorkMode: TWorkMode);
begin
showmessage('发信完毕');
end;

procedure TForm1.IdSMTP1Disconnected(Sender: TObject);
begin
showmessage('连接断开');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
idmessage1.From.Address := edit1.Text;
idmessage1.Subject := edit2.text;
idmessage1.Body.Assign(memo1.Lines);
idmessage1.Recipients.EMailAddresses := edit6.Text;
idsmtp1.Host := edit3.Text;
idsmtp1.Port := 25;
idsmtp1.Username :=edit5.Text;
idsmtp1.Password := edit4.Text;
idsmtp1.Connect();
idsmtp1.AuthenticationType := atlogin;
idsmtp1.Send(idmessage1);
end;

end.

相关阅读 >>

Delphi 简单字符串截取函数

Delphi winapi: windowfrompoint- 获取指定点所在窗口的句柄

如何将string变量赋值给pchar变量

Delphi xe6 读取android设备联系人

Delphi 怎样判断windows的dpi大小?

Delphi 如何获取重载函数的地址

Delphi 2009 查看所有 unicode 字符

Delphi d10.x 在android 9及更高版本下使用Delphi获取设备序列号?

Delphi中实现dll文件自动注册

Delphi 从其它access数据导入数据到本地数据库

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...