读书人

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

发布时间: 2012-10-19 16:53:35 作者: rapoo

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

读书人网 >.NET

热点推荐