河北三个石头  

 /**//// <summary>
            
/// 利用Jmail发送邮件
            
/// </summary>

            private void SendMailByJmail()
            
{
                /**////建立发邮件类
                jmail.MessageClass oJmailMessage = new jmail.MessageClass();
                
                /**//// 字符集
                oJmailMessage.Charset = "GB2312";

                /**////附件的编码格式
                oJmailMessage.Encoding = "BASE64";
                oJmailMessage.ContentType = "text/html";

                /**////是否将信头编码成iso-8859-1字符集
                oJmailMessage.ISOEncodeHeaders = false;

                /**//// 优先级
                oJmailMessage.Priority = Convert.ToByte(1);
                
            /**////发送人邮件地址
                oJmailMessage.From = "gj7722064@163.com";
                
                /**////发送人姓名
                oJmailMessage.FromName    = "gj";

                /**//// 邮件主题
                oJmailMessage.Subject    = "test_email";

                /**////身份验证的用户名
                oJmailMessage.MailServerUserName = "gj7722064";

                /**////用户密码
                oJmailMessage.MailServerPassWord = "密码";

                /**////添加一个收件人,抄送人和密送人的添加和该方法是一样的,只是分别使用AddRecipientCC和RecipientBCC两个属性
                
///要是需要添加多个收件人,则重复下面的语句即可。添加多个抄送和密送人的方法一样

                oJmailMessage.AddRecipient("gj7722064@163.com","","");
            //   if("" != upFile.PostedFile.FileName)
            
//    {
            
//        string attpath = upFile.PostedFile.FileName;
            
//        oJmailMessage.AddAttachment(@attpath,true,attpath.Substring(attpath.LastIndexOf(".")+1,3));//添加附件
            
//    }

                /**////邮件内容
                oJmailMessage.Body = "11111";

                if(oJmailMessage.Send("smtp.163.com",false))
                {
                    Response.Write("发送成功!");
                }

                else
                {
                    Response.Write("发送失败,请检查邮件服务器的设置!");
                }

                oJmailMessage = null;
            }

posted on 2013-06-08 21:20  河北三个石头  阅读(172)  评论(0编辑  收藏  举报