zoukankan      html  css  js  c++  java
  • godaddy的win主机发邮件的组件

    1 CDOSYS
    The server "relay-hosting.secureserver.net" is used to send email fromyour hosted domain. You must populate the SmtpMail object's SmtpServerproperty with this value. Our shared hosting servers allow for emailattachments up to 30 MB.
    复制内容到剪贴板
    代码:
    // 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
    }
    参考http://help.godaddy.com/article/1073
    2  CDONTS.NewMail
    复制内容到剪贴板
    代码:
    <%
    from = request.form("from")
    body = request.form("body")
    subject = request.form("subject")
    %>

    <%
    Dim objMail
    Set objMail = Server.CreateObject("CDONTS.NewMail")
    objMail.From = from
    objMail.Subject = subject
    objMail.To = "hard-code your email address"
    objMail.Body = body
    objMail.Send

    Set objMail = Nothing
    Response.redirect "thankyou.asp" '<- auto-redirection
    'You must always do this with CDONTS.
    'Change the page name to one that exists on your site.
    %>
    iis7.0下的代码示例
    复制内容到剪贴板
    代码:
    <%
    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
    %>
    [ 本帖最后由 add.c 于 2008-7-17 10:29 AM 编辑 ]
  • 相关阅读:
    信息探测
    Hdu 1262 寻找素数对
    Hdu 1263 水果
    Hdu 1261字串数
    Hdu 1253 胜利大逃亡
    Hdu 1237简单计算器
    Hdu 1235 统计同成绩学生人数
    Hdu 1236 排名
    Hdu 1233 还是畅通工程
    Hdu 1234 开门人和关门人
  • 原文地址:https://www.cnblogs.com/panzhilei/p/1408807.html
Copyright © 2011-2022 走看看