|
|
yijintong
发表于 2008-1-4 14:58:49
|
显示全部楼层
忙活了2天,终于搞这定了。
以下是方法的链接:http://www.lunarforums.com/lunarpages_asp/solution_to_using_form_to_send_email_from_asp_page_using_cdosys-t44402.0.html;msg314372#msg314372
内容如下:
Hi,
this is to help others on Windoze hosting plans who may be having problems setting their asp form to send them an email, feedback etc.
I was able to get the CDOSYS script working on my Windoze hosting plan after making the following modifications. That script can be found under asp in the knowledgebase website of Lunarpages: https://support.lunarpages.com/knowledge_bases/article/273
Note, my domain name is: ajmasters.com
1 - Make sure the email you use to send FROM does exist with your domain. i.e. you need to create an email with your domain name.
ex: I created this email: fromWeb@ajmasters.com
2- Make sure the email you send TO does exist with your domain. It did not work when trying to send to an email outside like something@yahoo.com but it did ok when using my own. i.e. you need to create an email with your domain name. (you can then set that email to redirect outside if you want) ex: I created this email: Tomyself@ajmasters.com
3- Change the port from 25 to 2 on this line: Const cdoSendUsingPort = 2
Here is the script below, make the appropriate changes using your own domain name.
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Dim strSmartHost
Const cdoSendUsingPort = 2
StrSmartHost = "localhost"
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With
strBody = "This is a test of sending an email via ASP" & vbCrLf & vbCrLf
strBody = strBody & "This is line 2. " & vbCrLf
strBody = strBody & "you can have as many as you want" & vbCrLf
strBody = strBody & "THIS IS AN AUTOMATED EMAIL - PLEASE DO NOT REPLY"
With iMsg
Set .Configuration = iConf
.To = "Tomyself@ajmasters.com"
.From = "fromWeb@ajmasters.com"
.Subject = "LEADS FROM MY FORM "
.textbody = strBody
'redirect code goes here
.Send
End With
' cleanup of variables
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
中文大致意思如下:
接收 ("fromWeb@ajmasters.com")和 发送("Tomyself@ajmasters.com")的邮箱账号必须是你的域名(ajmasters.com) 的,即是你的用你的域名开通的邮箱账号。
其它的邮箱地址,你可以用转发功能(接收邮箱转发,如例子里的"Tomyself@ajmasters.com") |
|