欢迎光临
我们一直在努力

用HTML格式发送邮件

建站超值云服务器,限时71元/月

你可以通过smtp服务或者ms exchange发送html格式的邮件,但是,你需要注意的是,并不是所有的clients都可以正常显示。在通常的情况下,cdonts发送邮件是使用plain-text格式。在使用html方式的时候我们可以进行更多的设置,例如不同的字体,颜色,插入图片等等。下面是一个例子
<%
  dim objmail
  set objmail = server.createobject("cdonts.newmail")
   
  //these are all the images that are in this message.
  //you must include them like this.
  //please note that you do not have to write the
  //entire file path in the <img> tag in the body after this.
  //make sure you see the image name after the path separated by a comma
   
  objmail.attachurl "d:\images\myimage.gif", "myimage.gif"
  objmail.attachurl "d:\images\myimage2.gif", "myimage2.gif"

  html = html & "<html>"
  html = html & "<head>"
  html = html & "<title>send mail with html</title>"
  html = html & "</head>"
  html = html & "<body  bgcolor=""lightyellow"">"
  html = html & "<table cellpadding=""4"">"
  html = html & "<tr><th><font color=""darkblue""  size=""4"">"
  html = html & now() & " – "
  html = html & "these are all great asp sites</font></th></tr>"
  html = html & "<tr><td>"
  html = html & "<a href=""http://www.4guysfromrolla.com"">"
  html = html & "<img src=""myimage.gif""></a><br><br>"
  html = html & "<a href=""http://www.4guysfromrolla.com"">"
  html = html & "<img src=""myimage2.gif""></a><br><br>"
  html = html & "</font></td></tr></table><br><br>"
  html = html & "</body>"
  html = html & "</html>"
  
  objmail.from = "rob@tconsult.com"
  objmail.subject = "your daily html mail"
      
  you need to add these lines for the mail
  to be sent in html format
  objmail.bodyformat = 0
  objmail.mailformat = 0

  objmail.to = "you@yourhouse.com
  objmail.body = html
  objmail.send
  
  response.write("mail was sent")
  set objmail = nothing
%>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 用HTML格式发送邮件
分享到: 更多 (0)

相关推荐

  • 暂无文章