日期:2014-05-17  浏览次数:20434 次

关于jmail邮件发送的问题

        protected void Button1_Click(object sender, EventArgs e)
        {
            //我这里测试的邮件账号是codeany@163.com
            //测试的密码是就不投入给大家了,改成自己的密码就好了
            //接受邮箱可以随便写一个你自己喜欢的邮箱
            jmail.Message Jmail = new jmail.Message();          //创建一个jmail对象                  
            String Subject = "邮件测试";                            //设置发送邮件的主题
            String body = "来自测试邮件";           //设置发送邮件的内容
            String FromEmail = "593981469@qq.com";               //发送的邮箱
            String ToEmail = "425445289@qq.com";                 //接受的邮箱
            Jmail.Silent = true;                                //安静的发送邮件
            Jmail.Charset = "GB2312";                           //设置发送邮件的字符集
            Jmail.ContentType = "text/html";
            Jmail.AddRecipient(ToEmail);                        //添加发送的邮件
            Jmail.From = FromEmail;                             //从何处发送
            Jmail.MailServerUserName = "123";               //发件人姓名
            Jmail.MailServerPassWord = "*********";             //发件邮件的密码 
            Jmail.Subject = Subject;                            //发件邮件的主题
            Jmail.AddAttachment(@"d:\data.txt", true, null);    //添加I