IIS内置组件CDONTS发邮件问题?

代码如下:

 1   
 2sub sendmail(fromaddress,toaddress,title,body)   
 3dim mail   
 4set mail=server.createObject("CDONTS.Newmail")   
 5mail.from=fromaddress   
 6mail.to=toaddress   
 7mail.subject=title   
 8mail.body=body   
 9'send方法的格式为:mail.send([from][,to][,subject][,body])   
10  
11mail.send   
12set mail=nothing   
13end sub   
14  
15fromaddress=TRIM(Request.form("fromaddress"))   
16toaddress=TRIM(Request.form("toaddress"))   
17Title=TRIM(Request.form("title"))   
18body=TRIM(Request.form("body"))   
19if toaddress<>"" then   
20sendmail fromaddress,toaddress,title,body   
21end if   
 1<html>
 2<title>发送Email</title>
 3<body>
 4<form =request.servervariables("sendmail")="" ```="" action="```" method="post">
 5<p>   
 6收件人:<input name="toaddress" size="25" type="text"/>
 7<p>   
 8发件人:<input name="fromaddress" size="25" type="text"/>
 9<p>   
10主题:<input name="title" size="25" type="text"/>
11<p>
12<textarea cols="40" name="body" rows="5"></textarea>
13<p>
14<input type="submit" value="发送"/>
15</p></p></p></p></p></form>
16</body>
17</html>

填写内容后页面发送,但收不到邮件。
---------------------------------------------------------------

代码改成:

 1   
 2fromaddress=TRIM(Request.form("fromaddress"))   
 3toaddress=TRIM(Request.form("toaddress"))   
 4Title=TRIM(Request.form("title"))   
 5body=TRIM(Request.form("body"))   
 6sub sendmail(fromaddress,toaddress,title,body)   
 7dim mail   
 8set mail=server.createObject("CDONTS.Newmail")   
 9mail.from=fromaddress   
10mail.to=toaddress   
11mail.subject=title   
12mail.body=body   
13'send方法的格式为:mail.send([from][,to][,subject][,body])   
14  
15  
16if toaddress<>"" then   
17sendmail fromaddress,toaddress,title,body   
18mail.send   
19set mail=nothing   
20end sub   
21end if   
 1<html>
 2<title>发送Email</title>
 3<body>
 4<form =request.servervariables("sendmail")="" ```="" action="```" method="post">
 5<p>   
 6收件人:<input name="toaddress" size="25" type="text"/>
 7<p>   
 8发件人:<input name="fromaddress" size="25" type="text"/>
 9<p>   
10主题:<input name="title" size="25" type="text"/>
11<p>
12<textarea cols="40" name="body" rows="5"></textarea>
13<p>
14<input type="submit" value="发送"/>
15</p></p></p></p></p></form>
16</body>
17</html>

---------------------------------------------------------------

使用CDONTS发邮件当然是需要配置smtp,没有这个服务你的邮件是不能发出去的

Published At
Categories with Web编程
Tagged with
comments powered by Disqus