ASP.Net邮箱发邮件实例代码

所属分类: 网络编程 / ASP.NET 阅读数: 1927
收藏 0 赞 0 分享

复制代码 代码如下:

 public static void SendEmail()
    {

        System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
        //这里使用QQ的邮箱来发送测试,如果是其它邮箱,请根据其它邮箱POP3/IMAP/SMTP服务来设置

        client.Host = "smtp.qq.com";
        client.UseDefaultCredentials = false;
        client.Credentials = new System.Net.NetworkCredential("6你的邮箱www.jb51.net", "***密码***");
        client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
        System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage("60**你的*www.jb51.net"541**收件人的www.jb51.net");
        message.Subject = "主题";
        message.Body = "内容";
        message.BodyEncoding = System.Text.Encoding.UTF8;
        message.IsBodyHtml = true;

        try
        {
            client.Send(message);


        }
        catch
        {

        }

    }

更多精彩内容其他人还在看

用ASP.Net实现文件的在线压缩和解压缩

用ASP.Net实现文件的在线压缩和解压缩
收藏 0 赞 0 分享

ASP.NET中文件上传下载方法集合

ASP.NET中文件上传下载方法集合
收藏 0 赞 0 分享

ASP.NET通过Remoting service上传文件

ASP.NET通过Remoting service上传文件
收藏 0 赞 0 分享

ASP.NET2.0服务器控件之Render方法

ASP.NET2.0服务器控件之Render方法
收藏 0 赞 0 分享

ASP.NET2.0 WebRource,开发微调按钮控件

ASP.NET2.0 WebRource,开发微调按钮控件
收藏 0 赞 0 分享

ASP.NET2.0新特性概述

ASP.NET2.0新特性概述
收藏 0 赞 0 分享

介绍几个ASP.NET中容易忽略但却很重要的方法函数

介绍几个ASP.NET中容易忽略但却很重要的方法函数
收藏 0 赞 0 分享

asp.net2.0如何加密数据库联接字符串

asp.net2.0如何加密数据库联接字符串
收藏 0 赞 0 分享

用.NET 2.0压缩/解压功能处理大型数据

用.NET 2.0压缩/解压功能处理大型数据
收藏 0 赞 0 分享

ASP.NET入门随想之检票的老太太

ASP.NET入门随想之检票的老太太
收藏 0 赞 0 分享
查看更多