请问asp如何实现发送email?

grant_ren 2000-07-19 12:05:00
请问asp如何实现发送email?
资料说要在iis端设置,是吗?
是要装smtp吗?
若是win2000,如何设置.
...全文
438 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
hhzh426 2000-09-03
  • 打赏
  • 举报
回复
关注!
Michaelyfj 2000-07-23
  • 打赏
  • 举报
回复
非常关注...
华南虎哥 2000-07-21
  • 打赏
  • 举报
回复
不过我认为对于一些没有自己拥有主机而租用虚拟主机的人来说使用CDONTS比使用EMAIL组件划算。当然你可以双向选择,下面是一篇关于这方面的文章,希望有所帮助。
————————————————————————————————————
ASP发送E-MAIL

关键词:ASP, 组件Components

  如 果 你 希 望 用 ASP 发 送 E-MAIL , 你 需 要 安 装 一 个 A S P 部 件 。 有 几 种 第 三 方 厂 商 的 部 件 你 可 以 使 用 。 但 是 在 IIS4 下 , 你 可 以 使 用 CDONTS 。
    虽 然 名 字 奇 怪 , 它 是 很 容 易 使 用 的 并 且 性 能 良 好 。 如 果 你 希 望 使 用 它 , 请 跟 随 下 面 步 骤 。
    1. 检 查 你 是 否 安 装 了 SMTP 服 务 。 OPTION PACK 缺 省 安 装 时 是 包 括 SMTP 服 务 的 。
    SMTP 服 务 安 装 后 , 在 你 的 system32 目 录 下 会 有 一 个 文 件 叫 CDONTS.DLL。
    2. 你 可 以 用 下 面 的 简 单 脚 本 通 过 A S P 发 送 E-MAIL :

    <%
    Dim MailObject
    Set MailObject = Server.CreateObject("CDONTS.NewMail")

    MailObject.Send "stelede@ozemail.com.au","stelede@ozemail.com.au","My subject","My text"
    %>
    是 不 是 很 简 单 ?


    发 送 附 件
    CDONTS 的 一 个 常 用 特 性 是 用 来 在 E-MAIL 中 发 送 附 件 。 代 码 也 不 难 写 。
    <%
    Dim MailObject
    Set MailObject = Server.CreateObject("CDONTS.NewMail")

    att_file="c:\attachments\StandardPolicy.txt"
    f_name="Policy.txt"

    MailObject.From="stelede@ozemail.com.au"
    MailObject.To="j_smith@zentus.com"

    MailObject.Subject="Subject Text Here"
    MailObject.Body="Body Text Here"
    MailObject.AttachFile att_file,f_name

    MailObject.Send
    %>

    第 三 方 厂 商 部 件
    如 果 你 对 CDONTS 不 满 意 , 下 面 的 地 址 清 单 是 你 可 以 找 到 的 第 三 方 厂 商 部 件 ( 大 多 数 你 需 要 花 钱 购 买 )
    Blat - http://gepasi.dbs.aber.ac.uk/softw/Blat.html
    Try Looking through: http://www.15seconds.com/
Tyro 2000-07-21
  • 打赏
  • 举报
回复
re:wumou
能说说CDONTS为什么不可靠吗?
wumou 2000-07-21
  • 打赏
  • 举报
回复
查询有关资料,CDONTS不可靠!!!! 如果不想作个玩具,千万别用.
不如使用其他组件.强力推荐jmail,下载包后里面有,(chinaasp有下载)
完整文当,例子.不过对某些版本的sp冲突,需要升级到sp6a
amavis 2000-07-21
  • 打赏
  • 举报
回复
我用的是flicks的Aspmail
觉得挺好使的
不象CDONTS,它可以设置Smtp服务器
但不知道如何注册或者Crack
每次发出的信件底下都被盖了戳
那位高手提示一下
wumou 2000-07-21
  • 打赏
  • 举报
回复
在有多个用户,负担较重时,cdo不能很好地起作用(若不止一个客户同时发送
email,则可能有一条被覆盖)
justle 2000-07-20
  • 打赏
  • 举报
回复
在NT的Option Pack中有相关的控件,所以说这种功能只能在NT Server上使用,可以参阅http://www.99g1.com/cdonline有关内容
Tyro 2000-07-20
  • 打赏
  • 举报
回复
用ASP发电子邮件源代码:
--------------------------------------------------------------------------<%
Dim strTo, strSubject, strBody 'Strings for recipient, subject, boby
Dim objCDOMail 'The CDO object

'First we'll read in the values entered
strTo = Request.Form("to")

'These would read the message subject and body if we let you enter it
'strSubject = Request.Form("subject")
'strBody = Request.Form("body")

strSubject = "Sample E-mail sent from ASP 101!"

' This is multi-lined simply for readability
strBody = "This message was sent from a sample at http://www.asp101.com."
strBody = strBody & "It is used to show people how to send e-mail froman "
strBody = strBody & "Active Server Page. If you did not request this "
strBody = strBody & "e-mail yourself, your address was entered by one of "
strBody = strBody & "our visitors. We do not store these e-mail addresses."
strBody = strBody & " Please address all concerns to webmaster@asp101.com."

'Ok we've got the values now on to the point of the script.

'We just check to see if someone has entered anything into the to field.
'If it's equal to nothing we show the form, otherwise we send the message.
'If you were doing this for real you might want to check other fields too
'and do a little entry validation like checking for valid syntax etc.
If strTo = "" Then %>
<FORM ACTION="./email_cdo.asp" METHOD="post">
Enter your e-mail address:<BR>
<INPUT TYPE="text" NAME="to" SIZE="30"></INPUT>
<!-- These would be used if we decided to let you edit them
Subject: <INPUT TYPE="text" NAME="subject" SIZE="30"></INPUT><BR>
Message: <TEXTAREA NAME="body" ROWS="10" COLS="40" WRAP="virtual"></TEXTAREA><BR>
-->
<INPUT TYPE="submit" VALUE="Send Mail!"></INPUT>
</FORM>
<% Else
' Create an instance of the NewMail object.
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")

' Set the properties of the object
objCDOMail.From = "webmaster@asp101.com"
objCDOMail.To = strTo
objCDOMail.Subject = strSubject
objCDOMail.Body = strBody
' There are lots of other properties you can use.
' You can send HTML e-mail, attachments, etc...
' You can also modify most aspects of the message
' like importance, custom headers, ...
' Check the documentation for a full list as well
' as the correct syntax.
' Some of the more useful ones I've included samples of here:
'objCDOMail.Cc = "john@asp101.com;gary@asp101.com"
'objCDOMail.Bcc = "john@asp101.com;gary@asp101.com"
'objCDOMail.Importance = 1 '(0=Low, 1=Normal, 2=High)
'objCDOMail.AttachFile "c:\path\filename.txt", "filename.txt"

' Send the message!
objCDOMail.Send

' Set the object to nothing because it immediately becomes
' invalid after calling the Send method.
Set objCDOMail = Nothing

Response.Write "Message sent to " & strTo & "!"
End If
%>
Tyro 2000-07-19
  • 打赏
  • 举报
回复
我有篇文章,你看一下吧!
希望对你又帮助
蝈蝈俊 2000-07-19
  • 打赏
  • 举报
回复
装个发email的控件,在asp中调用。
cjlong 2000-07-19
  • 打赏
  • 举报
回复
使用内置组件 cdonts.newmail 简单,高效
xfile 2000-07-19
  • 打赏
  • 举报
回复
Tyro,你好,
可否把答案贴出来,share一下
Tyro 2000-07-19
  • 打赏
  • 举报
回复
收到我的邮件了吗?
蝈蝈俊 2000-07-19
  • 打赏
  • 举报
回复
实现ASP文件在线发邮件

笔者在实践中利用ASP的COM组件功能,在VB中实现了一个发邮件的小组件,在ASP中只通过轻松调用,就可以实现该功能。所有邮件处理机制都被封装在这个组件中,使用起来极为方便。下面将详细介绍该组件的基本开发原理以及在ASP中的应用。

  1. 利用Winsock控件与发送邮件的SMTP联系

  和SMTP的联系包括握手、发送数据以及关闭等全过程,主要程序如下:

  建立一个frmsendmail 的窗体,其中包含一个Winsock控件,有以下几个公共变量:

  Public mSTMP As String

  //发送邮件的STMP

  Public mFrom As String

  //FROM 地址

  Public mTo As String

  //到达地址

  Public mSubject As String

  //邮件主题

  Public mText As String  

  //邮件正文

  Sock.Connect mSTMP, 25

  //和发送邮件的STMP建立联系

  Private Sub Sock_Connect()

    SFlag = sfConn

  //连接成功后设置参数

  End Sub

  Private Sub Sock_DataArrival(ByVal bytesTotal As Long)

    On Error GoTo daErr

    Dim s As String

    Sock.GetData s

    Select Case SFlag

      Case sfStart

      Case sfConn

        SFlag = sfHelo

  //发出握手信息HELLO

      Send "HELO "
grant_ren 2000-07-19
  • 打赏
  • 举报
回复
Tyro你好,
请把文章发来吧。
grant_ren@263.net

谢谢.

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧