该函数是根据某网上一函数改编而来的,至于是什么时候改的我也不记得了。
<%
'sent_address 发送者地址
'sent_name 发送者姓名
'sent_them 邮件主题
'sent_username 邮箱用户名
'sent_password 邮箱密码
'receive_address 接收者地址
'receive_htmlbody 邮件html内容
'receive_body 邮件纯内容
'sent_pop 邮件服务器
sub sent_email(sent_username,sent_password,sent_pop,sent_address,sent_name,sent_them,receive_address,receive_htmlbody)
On error resume next
Dim JMail, contentId
Set JMail = Server.CreateObject("JMail.Message")
JMail.Charset = "gb2312"
JMail.From = trim(sent_address)
JMail.FromName = trim(sent_name)
JMail.Subject = trim(sent_them)
JMail.MailServerUserName = trim(sent_username)
JMail.MailServerPassword = trim(sent_password)
JMail.Priority = 3
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.AddRecipient(trim(receive_address))
JMail.HTMLBody = trim(receive_htmlbody)
JMail.Body = "我们的邮件采用了HTML格式,但是您的邮件查看软件可能不支持。"
JMail.Send(trim(sent_pop))
JMail.Close()
Set JMail = Nothing
if err.number<>0 then
response.write "<script language='javascript'>alert(""发送失败!"");</script>"
else
response.write "<script language='javascript'>alert(""发送成功!"");</script>"
end if
end sub
%>
调用该函数用
<%
call sent_email("")
%>