发送邮件


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58
 引入:System.Net.Mail

        string rtnMsg = "";
        SmtpClient client = new SmtpClient("192.168.16.200");
        MailMessage msg = new MailMessage("@lvshou.com", "zhengxuesong@lvshou.com");
        msg.SubjectEncoding = msg.BodyEncoding = Encoding.GetEncoding("gb2312");
        msg.Subject = "hello";
        msg.Body = "hello,mail";
        try
        {
            client.Send(msg);
            result = true;
            ClientScript.RegisterStartupScript(this.GetType(), "msg", "");
        }

        catch (Exception e1)
        {
            result = false;
            ClientScript.RegisterStartupScript(this.GetType(), "msg", "");
        }