请问斑竹有关大富翁发Mail的功能实现(0分)

  • 主题发起人 主题发起人 Jao
  • 开始时间 开始时间
J

Jao

Unregistered / Unconfirmed
GUEST, unregistred user!
先向斑竹致礼,
请问,我发现在大富翁提出问题一Sumbit很快就显示出来给谁发了mail,
可是我编的程序就没这么快,连接Email Server就得花几秒钟的时间,总
共下来慢的时候要用一分钟。不知道斑竹是怎么处理这问题的,能指点一二吗?谢谢!
 
1、可能我的 mail server 离得比较近。
2、我直接用 socket 与 mail server 进行通讯。
 
你要快,最简单的方法是自己在程序里加一个smtp server,那么就可以直接送到对方服务器上了
 
我感觉,当yysun的ASP返回告诉你说"给xxx发送了邮件通知"时, 邮件不一定
就已经发送出去了,因为ASP调用的是一个ActiveX吧? 仅仅是"我发了",不能
保证"发出去了".邮件的发送应该是在后台完成的吧?
 
我觉得发送Mail并不太花时间,花时间的是与server连接的过程。To cAkk,我
对ActiveX不太熟,不过我想不管前台还是后台,在与Mail server连接时,程序
一定得hold在那里等,否则怎么知道有没有连上?怎么识别要不要进行下一步的
发送?不知道是不是这样。
我觉得这个是不是取决于Mail server的速度?
 
sorry, agree with Cakk
 
CJ: 你从来没正确拼写过我的名字!
 
poor cakk...Cakk...cAKK...cAkk:-)
yysun, 用的是optionpack代的smtp server吗?
另外分分数什么时候可以更正? 我可以帮忙的呀:-(
 
给200分的话我给贴一段asp的邮件发送程序
 
到www.chinasp.com查阅"精华区"可以查到asp发邮件的例子.
 
有那么麻烦吗?
asp send mail与html原理一样,只不过用script进行整体安排罢了
 
给你贴一段用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 &amp;
"It is used to show people how to send e-mail from an "
strBody = strBody &amp;
"Active Server Page. If you did not request this "
strBody = strBody &amp;
"e-mail yourself, your address was entered by one of "
strBody = strBody &amp;
"our visitors. Wedo
not store these e-mail addresses."
strBody = strBody &amp;
" 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 weredo
ing this for real you might want to check other fields too
'anddo
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:&amp;nbsp;
<INPUT TYPE="text" NAME="subject" SIZE="30"></INPUT><BR>
Message:&amp;nbsp;
<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 thedo
cumentation 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 " &amp;
strTo &amp;
"!"
End If
%>
 
刚才贴的代码被执行了,再来一次
<pre>
<%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 &amp;
"It is used to show people how to send e-mail from an "
strBody = strBody &amp;
"Active Server Page. If you did not request this "
strBody = strBody &amp;
"e-mail yourself, your address was entered by one of "
strBody = strBody &amp;
"our visitors. Wedo
not store these e-mail addresses."
strBody = strBody &amp;
" 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 weredo
ing this for real you might want to check other fields too
'anddo
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:&amp;nbsp;
<INPUT TYPE="text" NAME="subject" SIZE="30"></INPUT><BR>
Message:&amp;nbsp;
<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 thedo
cumentation 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 " &amp;
strTo &amp;
"!"
End If
%>
</pre>
 
<pre>
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 &amp;
"It is used to show people how to send e-mail from an "
strBody = strBody &amp;
"Active Server Page. If you did not request this "
strBody = strBody &amp;
"e-mail yourself, your address was entered by one of "
strBody = strBody &amp;
"our visitors. Wedo
not store these e-mail addresses."
strBody = strBody &amp;
" 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 weredo
ing this for real you might want to check other fields too
'anddo
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:&amp;nbsp;
<INPUT TYPE="text" NAME="subject" SIZE="30"></INPUT><BR>
Message:&amp;nbsp;
<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 thedo
cumentation 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 " &amp;
strTo &amp;
"!"
End If
</pre>
 
呵呵, 就是chinaasp中的例子嘛:-)
 
后退
顶部