首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

Delphi 2010 应用IdSMTP发送含附件的Email

2012-10-19 
Delphi 2010 使用IdSMTP发送含附件的Email程序原本在Delphi 2007下编译通过,现在在2010下有两个错误TidAtt

Delphi 2010 使用IdSMTP发送含附件的Email
程序原本在Delphi 2007下编译通过,现在在2010下有两个错误

  TidAttachment.Create(IdMessage.MessageParts,OutPath + '\'+ FormatDateTime('YYYYMMDD',frmMain.dtpDate.Date)+'.xls');

  IdSMTP.AuthenticationType:=atLogin;

编译提示错误如下:
[DCC Error] Main.pas(444): E2003 Undeclared identifier: 'TidAttachment'
[DCC Error] Main.pas(444): E2066 Missing operator or semicolon
[DCC Error] Main.pas(444): E2010 Incompatible types: 'TComponent' and 'TIdMessageParts'

[DCC Error] Main.pas(446): E2003 Undeclared identifier: 'AuthenticationType'
[DCC Error] Main.pas(446): E2003 Undeclared identifier: 'atLogin'

经查找,Delphi 2010需要uses IdAttachment,在uses单元增加IdAttachment后
编译提示错误如下:
[DCC Error] Main.pas(444): E2034 Too many actual parameters
[DCC Warning] Main.pas(444): W1020 Constructing instance of 'TIdAttachment' containing abstract method 'TIdAttachment.OpenLoadStream'

[DCC Error] Main.pas(446): E2003 Undeclared identifier: 'AuthenticationType'
[DCC Error] Main.pas(446): E2003 Undeclared identifier: 'atLogin'

帮忙,帮忙。国庆宅在家里的都来帮忙吧。反正闲着也是闲着。

[解决办法]
TIdAttachmentFile

热点排行