{拉2个控件下来IdSMTP1(在Indy Clients页面), IdMessage1(在Indy Misc页面)
实现从[email protected]邮箱发送带附件的邮件到[email protected]邮箱}procedure TForm1.SendMail;
begin
with IdSMTP1 do
begin
Host:='smtp.163.com';
Port:=25;
Username:='XXOO';
Password:='13800138000';
AuthenticationType:=atLogin;
end; with IdMessage1 do
begin
MessageParts.Clear;
Recipients.EMailAddresses:='[email protected]';
From.address:='[email protected]';
Subject:='Hello';
Body.Add('Hello World');
end; TIdAttachment.Create(IdMessage1.MessageParts,'D:\1.xls'); try
IdSMTP1.Connect;
except on E: Exception do
begin
showmessage('连接服务嚣失败:'+E.Message);
exit;
end;
end; try
if IdSMTP1.Authenticate then
begin
try
IdSMTP1.Send(IdMessage1);
except on E: Exception do
begin
showmessage('在发送过程中发生错误:'+E.Message);
exit;
end;
end; showmessage('发送成功!');
end;
finally
IdSMTP1.Disconnect;
end;
end;
实现从[email protected]邮箱发送带附件的邮件到[email protected]邮箱}procedure TForm1.SendMail;
begin
with IdSMTP1 do
begin
Host:='smtp.163.com';
Port:=25;
Username:='XXOO';
Password:='13800138000';
AuthenticationType:=atLogin;
end; with IdMessage1 do
begin
MessageParts.Clear;
Recipients.EMailAddresses:='[email protected]';
From.address:='[email protected]';
Subject:='Hello';
Body.Add('Hello World');
end; TIdAttachment.Create(IdMessage1.MessageParts,'D:\1.xls'); try
IdSMTP1.Connect;
except on E: Exception do
begin
showmessage('连接服务嚣失败:'+E.Message);
exit;
end;
end; try
if IdSMTP1.Authenticate then
begin
try
IdSMTP1.Send(IdMessage1);
except on E: Exception do
begin
showmessage('在发送过程中发生错误:'+E.Message);
exit;
end;
end; showmessage('发送成功!');
end;
finally
IdSMTP1.Disconnect;
end;
end;
解决方案 »
- delphi中两张图片的处理问题
- [高手进]程序编译时能否自动执行某段代码而运行时不执行?
- 怎么设置主界面为程序主窗体,登陆界面第一个显示?
- 我在程序中使用了clipboard,其它程序使用剪贴板就出问题
- 如何解决“连接失败”的问题?
- 请高手门看过来啊有关DELPHI当中解压缩的问题啊见人有分啊请各位高手发言啊
- 关于动态生成FORM
- dxdbgrid里怎么样添加过滤条件啊
- 我连接数据库一般是用BDE,但我看到大家都是用ADO连接,ADO比较BDE来有什么好处?
- 怎么办,我现在有些朦了,各位进来看看这个查询问题!!!!!!!!!!!!!!!!
- DELPHI循环读取TMemo里的内容,并添加到MDB数据库中。
- 请问,delphi调用Java写的Webservers接口,传入参数为什么没有生成类数据 在java接口里面参数定义的是数据,结果在Delphi里就生成的是类
我下午用JMail,自带的例子发送也不行
=?GB2312?B?yMvIt8jPytW79cfpv/ahow==?=
To: [email protected]
Content-Type: text/plain
Date: Tue, 20 Jan 2015 11:13:30 +0800
然后是回车后,才是实际传入的邮件内容!用163发的邮件,Delphi+indy控件包【IdMessage、IdSMTP】发送的邮件
之前是正常的,1月中旬后发送的邮件就如此了!