• 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 编辑 ]
  • 相关阅读:
    centos安装字体
    【C++ Primer | 15】访问控制与继承、继承中的类作用域
    树与二叉树 | 哈夫曼树
    【C++ Primer | 10】泛型算法
    【APUE | 03】文件I/O
    二叉树
    图论算法
    【深度探索C++对象模型 | 02】构造函数语意学
    【APUE | 08】进程控制
    c++重点理解
  • 原文地址:https://www.cnblogs.com/panzhilei/p/1408807.html
Copyright © 2020-2023  润新知