Exemplo n.º 1
0
    public void bindEmail()
    {
        string Subject  = "欢迎登陆物流信息管理平台";
        string Content  = "您登陆物流信息管理平台帐号为:" + name + "密码为:" + pass;
        string Receiver = txtEmail.Text;
        string server   = "Ls";

        jmail.MessageClass myJmail = new jmail.MessageClass();
        myJmail.Charset          = "GB2312";           //设置使用的邮件字符集,默认US-ASCII 中国则为GB2312
        myJmail.ISOEncodeHeaders = false;              //邮件头是否使用iso-8859-1编码 默认值为true;
        myJmail.From             = "*****@*****.**"; //返回或设置发件人的地址
        myJmail.Subject          = Subject;            //邮件的主题(标题)
        myJmail.AddRecipient(Receiver, "", "");        //添加收件人

        myJmail.Body = Content;                        //邮件的正文
        myJmail.Send(server, true);                    //发送邮件
    }
Exemplo n.º 2
0
        private string SendMail1(string from, string fromname, string to, string subject, string body, string username, string password, string server, string fujian)



        {
            jmail.MessageClass oJmailMessage = new jmail.MessageClass();

            /**//// 字符集

            oJmailMessage.Charset = "GB2312";

            oJmailMessage.ISOEncodeHeaders = false;

            /**//// 优先级

            oJmailMessage.Priority = Convert.ToByte(1);

            /**////发送人邮件地址

            oJmailMessage.From = (string)Session["email"];

            /**////发送人姓名

            oJmailMessage.FromName = fromname;

            /**//// 邮件主题

            oJmailMessage.Subject = subject;

            /**////身份验证的用户名

            oJmailMessage.MailServerUserName = "******";

            /**////用户密码

            oJmailMessage.MailServerPassWord = "******";

            /**////添加一个收件人,抄送人和密送人的添加和该方法是一样的,只是分别使用AddRecipientCC和RecipientBCC两个属性

            ///要是需要添加多个收件人,则重复下面的语句即可。添加多个抄送和密送人的方法一样

            oJmailMessage.AddRecipient("*****@*****.**", "", "");
            /**////邮件内容

            String a = "";

            oJmailMessage.Body = body;

            if (oJmailMessage.Send(server))

            {
                a = "发送成功!";
            }

            else

            {
                a = "发送失败,请检查邮件服务器的设置!";
            }

            oJmailMessage = null;

            return(a);
        }