给段在线发送email的代码(将表单的值提交在线发送到邮箱里)99分,不够俺再加~~~~

damner 2001-12-25 10:21:26
如:
你的信箱:________________
你要说的话:_________________________________________________
(最简单的功能啦,当然多给点功能当然更好啦)

将这个表单的内容在线发送到一个预定好的邮箱里能过CDONTS实现就行了。
有吗、给段代码吧~~~~~~~~~~~~~~~~~~~
...全文
503 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
damner 2001-12-27
  • 打赏
  • 举报
回复
哈哈,太谢谢了,这次的先结了,要是不成功再立新贴
ssm1226 2001-12-25
  • 打赏
  • 举报
回复
楼上的已经够详细了吧?不过呢,想发HTML邮件的话,还得加上点东东:
objEmail.BodyFormat=0 '内容格式
objEmail.MailFormat=0
mkiss 2001-12-25
  • 打赏
  • 举报
回复
这个可以了吧!
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>发送email</title>
</head>
<script language="javascript">
function check()
{
if (email.emailbox.value==""){
alert("邮件不能为空");
email.emailbox.focus();
return false;}
if (email.subject.value==""){
alert("主题不能为空");
email.subject.focus();
return false;}
if (email.body.value==""){
alert("内容不能为空");
email.body.focus();
return false;}
return true
}

</script>
<body>

<form method="POST" action="email.asp" name="email" onsubmit="return check()">
<p>你的信箱:  <input type="text" name="emailbox" size="24"></p>
<p>主    题:  <input type="text" name="subject" size="24"></p>
<p>你要说的话:<textarea rows="7" name="body" cols="53"></textarea></p>
<p><input type="submit" value="提交" name="B1"><input type="reset" value="重置" name="B2"></p>
</form>
<% emailbox=trim(request("emailbox"))
subject=trim(request("subject"))
body=trim(request("subject"))

if body="" then
response.write "<hr><br>内容不能为空!"
else
dim objCDOMail
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From =emailbox
objCDOMail.To ="abc@abc.com" '这是你指定要发的信箱,可以自己改
objCDOMail.Subject =subject
objCDOMail.Body =body
objCDOMail.Send
response.write "<hr><br>OK!一封邮件已经发送出去了!"

end if

%>
</body>

</html>
damner 2001-12-25
  • 打赏
  • 举报
回复
ssm1226(雨中人)
俺可没你想得聪明哟,那些值要从表单域里获取,就是从本页的表单里得到再赋给那些变量
ssm1226 2001-12-25
  • 打赏
  • 举报
回复
Set objMsg = Server.CreateObject("CDONTS.NewMail")

objMsg.From = strFrom '发信地址
objMsg.To = strTo '收信地址
objMsg.Subject = strSubject '主题
objMsg.Body = strBody '信内容
objEmail.BodyFormat=0 '内容格式
objEmail.MailFormat=0
objMsg.Send
damner 2001-12-25
  • 打赏
  • 举报
回复
 mkiss()
不哟太多阿,简单
--------------------------------------------
给粘一段不行呀??还说简单,眼高手低。
给俺一段代码就可以证明啦,说不如做!!!:)
ssm1226 2001-12-25
  • 打赏
  • 举报
回复
Set objMsg = Server.CreateObject("CDONTS.NewMail")

objMsg.From = strFrom
objMsg.To = strTo
objMsg.Subject = strSubject
objMsg.Body = strBody
objMsg.Importance = lngImportance
objMsg.Send
=============================================
Property Description
Bcc Sends a blind copy of the message to this semicolon-separated list
Body Contains the content of your message in text of HTML format
BodyFormat Sets the text format of the message
Cc Sends a copy of the message to the semicolon-separated list
ContentBase Sets the base property for URLs in the body of the message
ContentLocation Sets the absolute or relative paths for URLs contained in the message's body
From Sets the sender's address
Importance Sets the level of importance of the sent message
MailFormat Sets the mail encoding format to MIME or text format
Subject Sets the subject of the message
To Sends the message to this semicolon-separated list
Value Sets additional header information for the message
Version Retrieves the version of the CDONTS.DLL


=============================================
mkiss 2001-12-25
  • 打赏
  • 举报
回复
不哟太多阿,简单

28,406

社区成员

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

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