Delphi与ASP结合发邮件
program ASPSendMail;
uses Urlmon;
begin
UrlDownloadToFile(nil, Pchar('http://www.*****.com/good.asp?data=利用服务器发送邮件'), 0, 0, nil);
end.
以下是 good.asp 全部代码↓
<%
Dim senddata
senddata=Request("data")
if senddata="" then senddata=Time()
call SendEmail("sebooks@163.com","邮件主题",senddata,"sebooks@163.com")
Sub SendEmail(ToEmail,Subject,Content,FromEmail)
Set jmail = Server.CreateObject("JMAIL.Message")
jmail.silent = true
Jmail.logging = true
jmail.Charset = "GB2312"
jmail.ContentType = "text/html"
jmail.AddRecipient ToEmail
jmail.From = FromEmail
jmail.Subject = Subject
jmail.Body = Content
'jmail.Prority = 1 '邮件的紧急程序,1 为最快,5 为最慢, 3 为默认值
jmail.MailServerUserName = "sebooks" '登录邮件服务器所需的用户名
jmail.MailServerPassword = "嘿嘿,我的密码可不能说" '登录邮件服务器所需的密码
jmail.Send("SMTP.163.com") '执行邮件发送(通过邮件服务器地址)
jmail.Close() '关闭对象
Set jmail=nothing
End Sub
%>
把上面内容存成asp文件放到虚拟空间就行了.当然,前提是服务器有jmail.这个一般国内空间都支持的....随便黑几个空间放上去就行了....呵呵.