godaddy的win主机发邮件的组件
由于godaddy主机不支持jmail发信,主机环境是GoDaddy虚拟主机Windows iis7的,使用Collaboration Data Objects(CDO)或者CDOSYS发送邮件(email),IIS7环境下不支持CDONTS
1 CDOSYS
注:CDO和CDOSYS在iis6和IIS7环境下均可使用
The server "relay-hosting.secureserver.net" is used to send email from your hosted domain. You must populate the SmtpMail object's SmtpServerproperty with this value. GoDaddy的虚拟主机最大支持30M的附件.
引用:
// language -- C#
// import namespace
using System.Web.Mail;
private void SendEmail()
{
const string SERVER = "relay-hosting.secureserver.net";
MailMessage oMail = new System.Web.Mail.MailMessage();
oMail.From = "emailaddress@domainname";
oMail.To = "emailaddress@domainname";
oMail.Subject = "Test email subject";
oMail.BodyFormat = MailFormat.Html; // enumeration
oMail.Priority = MailPriority.High; // enumeration
oMail.Body = "Sent at: " + DateTime.Now;
SmtpMail.SmtpServer = SERVER;
SmtpMail.Send(oMail);
oMail = null; // free up resources
}
2.使用CDO发送邮件
注:CDO和CDOSYS在iis6和IIS7环境下均可使用
引用:
<%
sendUrl="http://schemas.microsoft.com/cdo/configuration/sendusing"
smtpUrl="http://schemas.microsoft.com/cdo/configuration/smtpserver"
' Set the mail server configuration
Set objConfig=CreateObject("CDO.Configuration")
objConfig.Fields.Item(sendUrl)=2 ' cdoSendUsingPort
objConfig.Fields.Item(smtpUrl)="relay-hosting.secureserver.net"
objConfig.Fields.Update
' Create and send the mail
Set objMail=CreateObject("CDO.Message")
' Use the config object created above
Set objMail.Configuration=objConfig
objMail.From="sender@coolexample.com"
objMail.ReplyTo="sender@coolexample.com"
objMail.To="recipient@coolexample.com"
objMail.Subject="subject"
objMail.TextBody="body"
objMail.Send
%>
官方地址:http://help.godaddy.com/article/4219
会员使用CDO.Message发邮件的例子:http://bbs.idcspy.com/redirect.p ... d=278784&ptid=25356
在godaddy使用CDO.Message可以发信
<%
Sub SendMail(Email,Subject,Message,EmailFrom,EmailUser,EmailPwd,EmailServer)
'Email 接收者e-mail地址 Subject 邮件主题 Message 邮件内容 EmailFrom 发信者e-mail地址
'EmailUser 邮箱账户(必须使用在godaddy注册的邮箱账户)
'EmailPwd 邮箱密码
'EmailServer 邮件服务器(一定要用relay-hosting.secureserver.net 其它的都会连接错误)
On Error Resume Next
Const cdoSendUsingMethod="http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort=2
Const cdoSMTPServer="http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort="http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPC
Const cdoSMTPAuthenticate="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic=1
Const cdoSendUserName="http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword="http://schemas.microsoft.com/cdo/configuration/sendpassword"
Dim objConfig
Dim objMessage
Dim Fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = EmailServer
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = EmailUser
.Item(cdoSendPassword) = EmailPwd
.Update
End With
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig
With objMessage
.To = Email
.From = EmailFrom
.Subject = Subject
.TextBody = Message
.Send
End With
If Err.Number <> 0 Then
SendEmailState = 2 'Failure
Else
SendEmailState = 1 'Success
End If
Err.Clear
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
End Sub
%>
以上代码已经测试成功,发信的时候直接调用SendMail子程序就可以了。
3.CDONTS
注:仅iis6下asp用
Sub SendMail(Email,Subject,Message,EmailFrom,EmailUser,EmailPwd,EmailServer)
'Email 接收者e-mail地址 Subject 邮件主题 Message 邮件内容 EmailFrom 发信者e-mail地址
'EmailUser 邮箱账户(必须使用在godaddy注册的邮箱账户)
'EmailPwd 邮箱密码
'EmailServer 邮件服务器(一定要用relay-hosting.secureserver.net 其它的都会连接错误)
On Error Resume Next
Const cdoSendUsingMethod="http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort=2
Const cdoSMTPServer="http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort="http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPC
Const cdoSMTPAuthenticate="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic=1
Const cdoSendUserName="http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword="http://schemas.microsoft.com/cdo/configuration/sendpassword"
Dim objConfig
Dim objMessage
Dim Fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = EmailServer
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = EmailUser
.Item(cdoSendPassword) = EmailPwd
.Update
End With
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig
With objMessage
.To = Email
.From = EmailFrom
.Subject = Subject
.TextBody = Message
.Send
End With
If Err.Number <> 0 Then
SendEmailState = 2 'Failure
Else
SendEmailState = 1 'Success
End If
Err.Clear
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
End Sub
%>
以上代码已经测试成功,发信的时候直接调用SendMail子程序就可以了。
3.CDONTS
注:仅iis6下asp用
引用:
<%
Dim MyBody
Dim MyCDONTSMail
Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
MyCDONTSMail.From= "sender@coolexample.com"
MyCDONTSMail.To= "recipient@coolexample.com"
MyCDONTSMail.Subject="Subject"
MyBody = "Body"
MyCDONTSMail.Body= MyBody
MyCDONTSMail.Send
set MyCDONTSMail=nothing
%>
评论

React 18的并发渲染确实是个重大改进,我们在项目中已经升级使用,性能提升明显!