由于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
}
<%
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
<%
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
%>
有话要说