| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 917 人关注过本帖
标题:[求助]文本格式发送邮件时邮件内容不分段
取消只看楼主 加入收藏
thbwn
Rank: 1
等 级:新手上路
帖 子:235
专家分:0
注 册:2007-10-2
结帖率:80%
收藏
 问题点数:0 回复次数:0 
[求助]文本格式发送邮件时邮件内容不分段
   以下代码是邮件发送系统,在以“文本格式”发送时,邮件内容出现不分段的问题,以“html格式”发送时没问题的,有没有办法解决。谢谢!
      红色部分是相关代码!
     不能加html代码,不然邮件内容就把html代码原原本本地显示出来了!


<%@ Language = VBScript %>
<%
action=request("action")
if action="ok" then
'==================================================title标题 gsname接收人 dgname点歌人 content温馨小语
' 参数设置开始,请修改相应参数
smtpserver = "smtp. '发送邮件所使用的SMTP服务器,例如smtp.,请修改
smtpuser = "123" '与SMTP服务器对应的邮箱用户名,请修改
smtppwd = "456" '与SMTP服务器对应的邮箱密码,请修改
smtpemail = "789@  'SMTP服务器发信邮箱,请修改
'myemail="789@ '用来接收邮件的邮箱,请修改,可以与SMTP服务器发信邮箱不同
' 参数设置结束
'==================================================
myemail=trim(Request("myemail"))
sendname = trim(Request("name")) '发件人名字
email = trim(Request("email")) '发件人邮箱
title = trim(Request("title"))
content = trim(Request("content"))
ishtml = trim(Request("ishtml"))
if sendname="" or email="" or title="" or c or myemail="" then
response.write "邮件发送失败,请填写每一项!<a href=javascript:history.go(-1)>返回上一页</a>"
response.end
end if

    if ishtml = "2" then
        
        mailbody=mailbody &"<style>A:visited {        TEXT-DECORATION: none        }"
        mailbody=mailbody &"A:active  {        TEXT-DECORATION: none        }"
        mailbody=mailbody &"A:hover   {        TEXT-DECORATION: underline        }"
        mailbody=mailbody &"A:link           {        text-decoration: none;}"
        mailbody=mailbody &"BODY   {        FONT-FAMILY: 宋体; FONT-SIZE: 9pt;}"
        mailbody=mailbody &"TD           {        FONT-FAMILY: 宋体; FONT-SIZE: 9pt        }</style>"
        mailbody=mailbody &"<TABLE border=0 width='95%' align=center><TBODY><TR><TD>"
        mailbody=mailbody &"您好!这是您的好友<font color=""#FF0000""</font>["&sendname&"]</font>给您发的邮件,以下是具体内容:<br>"
        mailbody=mailbody &"*************************************************************************************"        
        mailbody=mailbody &"<br><br>"&content&"<br><br><br><br><br><br>"
        mailbody=mailbody &"*************************************************************************************"
        mailbody=mailbody &"<br>此邮件由<a target=""blank"" href=""http://www. color=""#0000FF""</font>“服务之窗”(http://thbwn.)</a></font>在线邮件系统发送,请勿直接回复此邮件!<br>"
        mailbody=mailbody &"该邮件的发件人为["&sendname&"],发件人邮箱为["&email&"]!<br>"
        mailbody=mailbody &"如果需要回复,<font color=""#FF0000""</font>请发邮件至["&email&"]</font>,切记!本站对所发内容不负任何法律责任!<br>"
        mailbody=mailbody &"</TD></TR></TBODY></TABLE>"
        
        elseif ishtml = "1" then
        
        mailbody=mailbody &"您好!这是您的好友["&sendname&"]给您发的邮件,以下是具体内容:"        
        mailbody=mailbody &"*************************************************************************************"        
        mailbody=mailbody &""&content&""
        mailbody=mailbody &"*************************************************************************************"
        mailbody=mailbody &"此邮件由“服务之窗”(http://thbwn.)在线邮件系统发送,请勿直接回复此邮件!"
        mailbody=mailbody &"该邮件的发件人为["&sendname&"],发件人邮箱为["&email&"]!"
        mailbody=mailbody &"如果需要回复,请发邮件至["&email&"],切记!本站对所发内容不负任何法律责任!"

        
        end if
        

if sendname <> "" and email <> "" then
set jmail= server.CreateObject ("jmail.message")
jmail.Silent = true
jmail.Charset = "gb2312"
if ishtml = "2" then
JMail.C
elseif ishtml = "1" then
JMail.C
end if
jmail.From = smtpemail
jmail.FromName = sendname
jmail.ReplyTo = email
jmail.Subject = title
jmail.AddRecipient myemail
jmail.Body = mailbody
jmail.MailServerUserName = smtpuser
jmail.MailServerPassWord = smtppwd

isgo = jmail.Send(smtpserver)
if isgo then
msg="邮件发送成功!谢谢您的支持。"
else
msg = "邮件发送失败!请检查您的参数设置是否正确!"
end if

jmail.Close
set jmail = nothing
end if
end if
%>
<html>
<head>
<style>
BODY
{SCROLLBAR-ARROW-dCOLOR:#ff0000; SCROLLBAR-BASE-COLOR:#b8c8d8;background:#CAD7F7; FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif, 宋体}
A {text-decoration: none; font-size: 9pt;}
A:visited {TEXT-DECORATION: none; color: #555555;}
A:active {TEXT-DECORATION: none; color: #000000;}
A:hover {COLOR: #0099cc; TEXT-DECORATION: underline; TEXT-DECORATION:none; position:relative; left: 1px; top: 1px}
A:link {text-decoration: none; color: #0000A0;}
.t{LINE-HEIGHT: 1.4;}
P {FONT-SIZE:9pt; LINE-HEIGHT: 12pt;}
TD{font-size: 9pt; LINE-HEIGHT: 12pt;}
div {font-size: 9pt;}
input {font-family: "Tahoma", "Verdana"; font-size: 9pt;}
.STYLE1 {
        color: #FFFFFF;
        font-size: 14pt;
}
.STYLE2 {font-size: 12pt}
.STYLE4 {color: #FF0000}
</style>
<title>给朋友写信</title>
</head>
<body>
<%if msg<>"" then%>
<br><%=msg%><a href="javascript:history.go(-1)">返回上一页</a>
<%else%>                                                                                            
<form action="mail.asp" method=post>
  <table cellpadding="2" cellspacing="1" border="0" width="516" align=center>
  <input type="hidden" name="action" value="ok">
   <tr>
      <td height="24" colspan="4" bgcolor="#003366" class=forumrow><div align="center" class="STYLE1 STYLE2">给朋友写信</div>
        <div align="center"></div>
      <DIV align="center"></DIV></td>
    </tr>
   <tr>
     <td height="10" colspan="4" class=forumrow><div align="center"><span class="STYLE4">(请不要发送不良信息、无用信息)</span><br>
       <%dim t,k,j,y
t=(cint(day(date()))*24+cint(hour(time())))*60+cint(minute(time()))
k=0
j=1
y=0
Do While application("zxip"&j)<>""
if application("zxip"&j)=Request.ServerVariables("REMOTE_ADDR") then
application("zxsj"&j)=t
y=1
end if
if t-application("zxsj"&j)>9 or t<application("zxsj"&j) then
k=k+1
else
if k>0 then
application.lock
application("zxip"&j-k)=application("zxip"&j)
application("zxsj"&j-k)=application("zxsj"&j)
application.unlock
end if
end if
if k>0 then
application.lock
application("zxip"&j)=""
application.unlock
end if
j=j+1
loop
if y=0 then
application("zxip"&j)=Request.ServerVariables("REMOTE_ADDR")
application("zxsj"&j)=t
else
j=j-1
end if
response.write("您的IP:"&request.serverVariables("REMOTE_ADDR"))
%></div></td>
   </tr>
   <tr>
     <td colspan="4" class=forumrow> </td>
   </tr>
   <tr>
      <td width="89" class=forumrow> 好友E-mail:</td>
      <td colspan="3" class=forumrow><input name=myemail type=text id="myemail" size=30>
      <FONT color=#ff0000>*</FONT></td>                                                                                            
    </tr>

   <tr>
     <td class=forumrow> 您的姓名:</td>
     <td width="416" colspan="3" class=forumrow><input name=name type=text id="name" size=30>
      <font color=#ff0000>*</font></td>                                                            
   </tr>
    <tr>
      <td width="89" class=forumrow> 您的E-mail:</td>
      <td colspan="3" class=forumrow><input name=email type=text id="email" size=30>
      <FONT color=#ff0000>*</FONT> (如果朋友给您回信,将会回复到这个信箱)</td>                                                                                            
    </tr>
    <tr>
      <td width="89" class=forumrow> 邮件标题:</td>
      <td colspan="3" class=forumrow><input type=text name=title size=30 value="您好">
      <FONT color=#ff0000>*</FONT></td>                                                                                            
    </tr>
    <tr>
      <td width="89" rowspan="2" class=forumrow> 邮件内容:</td>
      <td colspan="3" class=forumrow>
<textarea name="content" cols="50" rows="9" class="smallinput" id="content">支持HTML标记,分段在段末加<br></textarea>
      <FONT color=#ff0000>*</FONT></td>                                                                                            
    </tr>
    <tr>
      <td colspan="3" class=forumrow><input type="radio" name="ishtml" value="1"<%if ishtml="" or ishtml="1" then response.Write(" checked")%>>文本格式<input type="radio" name="ishtml" value="2" <%if ishtml="2" then response.Write(" checked")%>>html格式</td>
    </tr>
    <tr>
      <td width="89" class=forumrow></td>
      <td height=20 colspan="3" class=forumrow>
        <input type="Submit" value="发送邮件" name="Submit">

        <input type="reset" name="Clear" value="重新填写">      </td>
    </tr>
  </table>
</form>
<%end if%>
</body>
</html>

[[it] 本帖最后由 thbwn 于 2008-4-15 17:33 编辑 [/it]]
搜索更多相关主题的帖子: 文本 邮件 格式 分段 
2008-04-15 16:57
快速回复:[求助]文本格式发送邮件时邮件内容不分段
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019042 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved