码迷,mamicode.com
首页 > Web开发 > 详细

ASP CDONTS.NEWMAIL组件发送电邮(附下载)

时间:2015-09-17 17:16:14      阅读:100      评论:0      收藏:0      [点我收藏+]

标签:

附CDONT.NEWMAIL组件下载地址:http://files.cnblogs.com/files/colinliu/cdonts.rar

 

ASP常规发送方法:

<%
  dim mail
  set mail=server.createobject("cdonts.newmail")
  mail.From=fromwho "发件人信箱
  mail.To = towho "收件人信箱
  mail.Subject =subject "主题
  mail.Body =body "邮件正文
  mail.MailFormat=0  "说明是以MIME发送
  mail.BodyFormat=0  "可以包含html代码
  mail.Importance=0  "邮件的优先级别0-1-2
  mail.cc=xx@xx.net   "抄送
  mail.Bcc=xx@sf.net  "密送
  mail.AttachFile attachfile "附件
  mail.Send
  Set mail=Nothing
      response.Write  "<script language=‘javascript‘>alert(‘电邮已发送‘);</script>"
%>

  

读取HTML然后发送!

<%
Dim fso, tf
Dim strHTML

Set fso = Server.CreateObject("SCRIPTING.FILESYSTEMOBJECT")
Set tf = fso.OpenTextFile("C:\Mail.htm", 1)
strHTML = tf.ReadAll

Write strHTML
Set tf = Nothing
Set fso = Nothing

Set objMail = Server.CreateObject("CDONTS.NEWMAIL")
objMail.From = "iamchn@263.net"
objMail.To = "iamchn@21cn.com"
objMail.Subject = "TEST7"
objMail.Body = strHTML

objMail.BodyFormat = 0
objMail.MailFormat = 0
objMail.Importance = 2
objMail.AttachURL "c:\logo.gif", "logo.gif"
objMail.Send
Set objMail = Nothing
response.Write  "<script language=‘javascript‘>alert(‘电邮已发送‘);</script>"
%>

  

-完-

ASP CDONTS.NEWMAIL组件发送电邮(附下载)

标签:

原文地址:http://www.cnblogs.com/colinliu/p/4816495.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!