如题,另外,能不能附原码?
解决方案 »
- “Access violation at address 74BD19A0” 咨询下74BD19A0这个什么意思?
- delphi 中TsmartQuery后有几个属性:sqlrefresh,sqllock代表什么,怎样使用呢 ?
- 如何在在二进制文件中查找$6D6F7374这个子串并返回指针的位置
- 为了去掉listview的横向滚动条,我把lstAlarm.Columns[0]的属性设置了autosize,但是加数据不刷新
- 头都大了,DBExpress的事务问题!
- 高手请进
- 计算年龄函数(精确到天数)
- 强烈抗议CSDN漠视DELPHI~~~~~~~~~~~`
- 请问有谁作过三层结构的MIS系统?速度比C/S慢多少?用DELPHI,有资料吗?
- InsideDelphi(ID) 非常感谢你。请来拿分
- savedialog自动保存问题。
- 升级程序再升级问题~
EmailServerPort,EmailAuthType:Integer;EmailUserEmail:String): boolean;
var
i,j,k,fgfIndex:Integer;
AttachmentFileName:String;
S:AnsiString;
tmpEMailItem,tmpCCEMailItem : TIdEMailAddressItem;
AttachmentFileSize:Integer;
begin
With IdMessage1 Do
begin
Body.Clear;
Body.Assign(MailBody.Lines);
{CharSet:='utf-8';//gb2312';
ContentType := CharSet;
ContentTransferEncoding := ContentType;}//影响正文 From.Address:=MailUsername; //你要发送邮件的完整地址'
From.Name :=MailUsername;//'发件人';
From.Text:=EmailUserEmail;
//Recipients.Add.Address:=Trim(RecvieMemo.Lines.Text);
Recipients.EMailAddresses:=Trim(RecvieMemo.Lines.Text);//'发送者地址';
for I := 0 to RecvieMemo.Lines.Count - 1 do //收件人实现群发
begin
S:=S+RecvieMemo.Lines.Strings[i];
end;
k:=0;
j:=Pos(';',S);
if j>0 then
tmpEMailItem := IdMessage1.BccList.Add; //添加一个地址列表
while j>0 do
begin
tmpEMailItem.Address:=Copy(S,0,j-1);
S:=Copy(S,j+1,MaxInt);
j:=Pos(';',S);
Inc(k);
end;
if k>0 then
tmpEMailItem.Address:=S; //最后一个 S:='';
for I := 0 to ReciveSecMemo.Lines.Count - 1 do //抄写人实现群发
begin
S:=S+ReciveSecMemo.Lines.Strings[i];
end;
k:=0;
j:=Pos(';',S);
if j>0 then
tmpCCEMailItem := IdMessage1.CCList.Add; //添加一个地址列表
while j>0 do
begin
tmpCCEMailItem.Address :=Copy(S,0,j-1);
S:=Copy(S,j+1,MaxInt);
j:=Pos(';',S);
Inc(k);
end;
if k>0 then
tmpCCEMailItem.Address:=S; //最后一个 Subject:=MailTitle;//主题
with TIdText.Create(IdMessage1.MessageParts, MailBody.Lines) do
begin
ContentType := 'text/plain';
end;
IdMessage1.MessageParts.Clear;
for I := 0 to MailAppen.Items.Count - 1 do
begin
AttachmentFileName := MailAppen.Items.Strings[i];
if fileExists(AttachmentFileName) then
begin
AttachmentFileSize:=AttachmentFileSize+GetSendAttchmentFileSizeof(AttachmentFileName);
if i > 0 then MessageParts.Add;
if FileExists(AttachmentFileName) then
TIdAttachmentFile.Create(IdMessage1.MessageParts, AttachmentFileName);
end;
end;
end;
ProgressBar1.Max:=AttachmentFileSize;
With IdSMTP1 Do
begin
try
Disconnect;
{authentication settings}
case SmtpAuthType of
0: AuthType := atNone;
1: AuthType := atDefault; {Simple Login}
end;
Username := MailUsername;
Password := MailPassword;
IdSMTP1.PipeLine:=False;//可以避开瑞星的监控
{General setup}
Host := EmailHost;
Port := SmtpServerPort;
ConnectTimeout:=300000;
Application.ProcessMessages;
Connect(); //连接SMTP服务器
Application.ProcessMessages;
Authenticate;
try
Application.ProcessMessages;
Send(IdMessage1); //向服务器发送邮箱
Except
end;
Finally
Disconnect;
end;
end;end;