{拉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;
解决方案 »
- 为什么我按照书上的写下来还是会错呢?
- Statusbar的AutoHint问题
- 如何发送邮件呀?????
- 状态栏如何使用?
- 怎樣pan別oldvalue和newvalue的数据是一样﹐
- 高手请进,解决后再送200分,UP有分
- 如何将控件置之窗口最上面?
- 如何将word文档转换成text?
- 函数的 result 为 TBitmap (或其他类似)类型时应该注意一些什么问题?
- 如何实现学生成绩单的分项打印
- 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月中旬后发送的邮件就如此了!