ASP调用W3JMail发送电子邮件

<%
response.Charset="UTF-8"

sub sendEmail(emails,biaoti,msg)
	Set jmail = Server.CreateObject("JMAIL.Message")
	if err<>0 then
		response.Write("对不起!<br>你的服务器还未安装发邮件的组件!请先运行w3JMai.exe安装")
		response.end
	end if	
	jmail.silent = true '不将错误返回给操作系统
	jmail.logging = true '启用邮件日志
	jmail.Charset = "utf-8" '邮件的文字编码
	jmail.From = "改请修" '发件人的E-MAIL
	jmail.FromName="改请修" '发件人的姓名,此项可省略
	jmail.MailServerUserName = "改请修" '登录邮件服务器所需的用户名
	jmail.MailServerPassword = "改请修" '登录邮件服务器所需的密码
	yxArr=split(emails,",")
	for each email in yxArr
		jmail.AddRecipient email
	next
	jmail.Subject = biaoti '邮件的标题
	jmail.Body = msg '邮件的内容
	if not jmail.Send("改请修,如smtp.163.com") then
		Response.write jmail.log
	else
		Response.write "邮件发送成功!"
	end if
	jmail.Close() : set jmail=nothing
end sub

emails="[email protected],[email protected]"
biaoti="TEST2245"
msg="欢迎光临!"
call sendEmail(emails,biaoti,msg)
%>

猜你喜欢

转载自hanbaohong.iteye.com/blog/2203461