要求:能实现邮件发送就行,D6环境请将代码发到[email protected]
或写出下载地址。要源吗,带注解。看懂后结贴
或写出下载地址。要源吗,带注解。看懂后结贴
解决方案 »
- 急!!! 数据库明细表问题?
- 如何动态载入DLL文件,其中DLL文件包括form等复杂控件。
- 谁有dxdbgrid,好像叫DevExQuantumGrid控件下载
- 没有安装Access的机子上,如何在程序中访问mdb库?
- 100分:简单问题,为什么有时出现“无法更新;当前被锁定”???
- 使用OleContainer控制word或excel,如何实现打印预览?如何在状态栏显示word或excel当前的状态?
- 得到三个三角,散600,这是第二个100分,11:50结贴
- 请大家推荐一些有漂亮控件(越漂亮越好)下载的网站,急用!
- 关于STRINGGRID的问题,很急,请指教
- 关于ListView的问题2222
- 请问关于用Delphi开发ASP组件时的调试方法?
- IFontDispatch与TFont类型不匹配,怎么办?
Fsend.Port :=25;
FSend.Username := //发送信箱用户名
FSend.Password := //密码
Femail.Subject := //主题
FEmail.Body.Text := //设置邮件内容
FEmail.From.Text := ; //设置发送邮箱地址
FEmail.ReplyTo.Clear;
FEmail.ReplyTo.Add.Text := ; FEmail.Recipients.Clear;
Femail.Recipients.EMailAddresses := ;//设置接受邮箱地址 Femail.MessageParts.Clear;
TIdAttachment.Create(Femail.MessageParts,附件完整路径);//添加附件try //发送
try
Fsend.Connect;
Fsend.Send(Femail);
Except
Fsend.DisconnectSocket ;
Fsend.Disconnect ;
application.MessageBox('连接SMTP服务器出现错误','错误',MB_ICONERROR);
exit;
end;
finally
Fsend.DisconnectSocket ;
Fsend.Disconnect ;
end;
IdSMTP1: TIdSMTP;
IdMessage1: TIdMessage;还有,我用d6中demo下的MailClient程序,不行,发不出去,提示“software caused connection abort”
但是收信可以,为什么??????????
Borland\Delphi6\Demos\FastNet\Smtp
●●●●TO:delphi99(delphi99)
Borland\Delphi6\Demos\FastNet\Smtp下的那个我试了,不行,出错,提示:“software caused connection abort”什么原因呀
var
s_IniFile: Tinifile;
s_Host, s_Mail_From,MailAddress: string;
s_line, s_attch:string;
s_file: textfile;
s_SubMail: string;
begin
s_IniFile := TIniFile.Create(ExtractFilePath(Application.Exename)+'Send.ini');
g_MailServer := s_IniFile.ReadString('Email','MailServer','');
g_MailAccount := s_IniFile.ReadString('Email','MailAccount','');
g_MailPWD := s_IniFile.ReadString('Email','MailPassword','');
g_MailAddress := s_IniFile.ReadString('Email','MailAddress','');
s_IniFile.Free; Result := False;
NMSmtp1.Host:= trim(g_MailServer);
NMSmtp1.UserID:=trim(g_MailAccount);
NMSMTP1.TimeOut:=20000; if not NMSMTP1.Connected then
try
NMSMTP1.Connect;
except
showmessage('邮件连接失败!');
Exit;
end; NMSmtp1.PostMessage.FromAddress:='';
NMSmtp1.PostMessage.FromAddress:=trim(g_MailAddress);
NMSmtp1.PostMessage.ToAddress.Clear; while pos(';',eMail)>0 do
begin
s_SubMail := copy(eMail,1,pos(';',eMail)-1);
NMSMTP1.PostMessage.ToAddress.Add(s_SubMail);
delete(eMail,1,pos(';',eMail));
end;
if length(eMail)>1 then
NMSMTP1.PostMessage.ToAddress.Add(eMail); NMSmtp1.PostMessage.Subject:='';
NMSmtp1.PostMessage.Subject:=trim(eSubject);
NMSmtp1.PostMessage.Body.Clear;
NMSMTP1.PostMessage.Body.Text:=trim(eBody); try
NMSmtp1.SendMail;
Result := True;
except
Result := False;
end;
NMSmtp1.Disconnect;end;