日期:2014-05-17  浏览次数:20909 次

关于jmail+asp发送邮件的问题
代码我就不贴了。我想知道是不是可以在邮件的正文里包含某一个网页。
还有就是我在发送html邮件的时候总是发送不成功     添加附件也出错。



------解决方案--------------------
可以,但要注意,如果要输出 ",在asp里面就是 " "
如:
<%
mainbody= " <!DOCTYPE HTML PUBLIC " "-//W3C//DTD HTML 4.01 Transitional//EN " " " "http://www.w3.org/TR/html4/loose.dtd " ">
"
%>
------解决方案--------------------
<%@LANGUAGE= "VBSCRIPT " CODEPAGE= "936 "%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml "> <style type= "text/css ">
<!--
body,td,th {
font-size: 14px;
color: #990000;
}
-->
</style>
<%
company_name = replace(request.Form( "company_name "), ", ", ", ")
lxr = replace(request.Form( "lxr "), ", ", ", ")
tel1 = replace(request.Form( "tel1 "), ", ", ", ")
tel2 = replace(request.Form( "tel2 "), ", ", ", ")
email = request.Form( "email ")
password = request.Form( "password ")
center = replace(request.Form( "center "), ", ", ", ")
date_time = now()

if company_name = " " then
response.Write( "公司名称不能为空! ")
response.end
end if

if lxr = " " then
response.Write( "联系人不能为空! ")
response.end
end if

if tel1 = " " then
response.Write( "联系电话不能为空! ")
response.end
end if
if email = " " then
response.Write( "您的E_mail不能为空! ")
response.end
end if
if center = " " then
response.Write( "留言内容不能为空! ")
response.end
end if
'sql = "insert into message (company_name,lxr,tel1,tel2,email,center,date_time) values ( ' "&company_name& " ', ' "&lxr& " ', ' "&tel1& " ', ' "&tel2& " ', ' "&email& " ', ' "&center& " ', ' "&date_time& " ') "
'objConn.execute(sql)

'response.Write( "感谢您的留言,我们会尽快与您联系! ")
'response.end

smtpserver= "mail.nivs.cn " '发送邮件所使用的SMTP服务器,例如smtp.163.com,请修改
smtpusername= "msg@nivs.cn " '与SMTP服务器对应的邮箱用户名,请修改
smtppwd= "000111 " '与SMTP服务器对应的邮箱密码,请修改 <br/>
myemail= "sannyhu@nivs.cn " '收件人email
smtpname=lxr '发件人姓名
topic=company_name
mailbody=center& " <p> <p> 联系人: "&lxr& " <p> 联系电话: "&tel1& "&nbsp;&nbsp;&nbsp;&nbsp; "&tel2& " <p> 留言人邮箱: "&email& " <p> 留言时间: "&date_time& " <p> <p> <b> 此邮件不能直接回复! <a taregt= " "_blank " " href= " "mailto: "&email& " " "> 请点该处回复!! </a> </b> "
set jmail= server.CreateObject( "jmail.message ")
jmail.Silent = true
jmail.Charset = "GB2312 "
jmail.ISOEncodeHeaders=false
JMail.ContentType= "text/html "
jmail.Priority = 3 <