如何用asp+ms sql的jmail收发邮件(内网和外网)
如何用asp+ms sql的jmail收发邮件(内网和外网)
------解决方案-------------------- dim JMail
Set JMail=Server.CreateObject( "JMail.Message ")
JMail.silent = true
JMail.Logging=True
JMail.Charset= "gb2312 "
JMail.ContentType = "text/html "
JMail.From= "XXXX@163.com "
JMail.FromName = "XXXX "
JMail.Subject=topic
JMail.Body=emailbody(mailbody)
do while (Instr(email, "; ")> 0)
JMail.AddRecipient left(email,((Instr(email, "; "))-1))
email=right(email,(len(email)-InStr(email, "; ")))
loop
JMail.AddRecipient email
JMail.Priority=1
JMail.Maildomain = "XXXXXX " 'smtp服务器
JMail.MailServerUserName = "XXXX " '您的邮件服务器登录名
JMail.MailServerPassword = "XXXX " '登录密码
JMail.Send( "XXXXXX ") 'smtp服务器
Set JMail=nothing
response.write " <br> 已经发送email至供应商(公司)和你填写的email地址,如果你没有收到email,请联系XXXXX。 <br> <br> <a href=http://XXXXXX> 返回首页 </a> "
conn.close
set conn=nothing
Function UnSqlStr(data)
unsqlstr=data
unsqlstr=replace(unsqlstr, "& ", "& ")
unsqlstr=replace(unsqlstr, "< ", " < ")
unsqlstr=replace(unsqlstr, "> ", "> ")
unsqlstr=replace(unsqlstr, "" ",chr(34))
end Function
function IsValidEmail(email)
dim names, name, i, c
IsValidEmail = true
names = Split(email, "@ ")
if UBound(names) <> 1 then
IsValidEmail = false
exit function
end if
for each name in names
if Len(name) <= 0 then
IsValidEmail = false
exit function
end if
for i = 1 to Len(name)
c = Lcase(Mid(name, i, 1))
if InStr( "abcdefghijklmnopqrstuvwxyz_-. ", c) <= 0 and not IsNumeric(c) then
IsValidEmail = false
exit function
end if
next
if Left(name, 1) = ". " or Right(name, 1) = ". " then
IsValidEmail = false
exit function
end if
next
if InStr(names(1), ". ") <= 0 then
IsValidEmail = false
exit function
end if
i = Len(names(1)) - InStrRev(names(1), ". ")
if i <> 2 and i <> 3 then
IsValidEmail = false
exit function
end if
if InStr(email, ".. ") > 0 then
IsValidEmail = false
end if
end function
function Emailbody(body)
Emailbody=Emailbody & " <style> A:visited { TEXT-DECORATION: none } "
Emailbody=Emailbody & "A:active { TEXT-DECORATION: none } "
Emailbody=Emailbody & "A:hover { TEXT-DECORATION: underline overline } "
Emailbody=Emailbody & "A:link { text-decoration: none;} "
Emailbody=Emailbody & "A:visited { text-decoration: none;} "
Emailbody=Emailbody & "A:active { TEXT-DECORATION: none;} "
Emailbody=Emailbody & "A:hover { TEXT-DECORATION: underline overline} "
Emailbody=Emailbody & "BODY { FONT-FAMILY: Arial; FONT-SIZE: 9pt;} "
Emailbody=Emailbody & "TD { FONT-FAMILY: Arial; FONT-SIZE: 9pt } </style> "
Emailbody=Emailbody & " <TABLE border=0 width= '95% ' align=center> <TBODY> <TR> "
Emailbody=Emai