示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (uid == null)
            {
                Response.Redirect("../../LogInPage.aspx");
            }
            if (!IsPostBack)
            {
                try
                {
                    TEmail info = BusinessSupply.BusinessOper.EmailBusiness.GetEmailById(Convert.ToInt32(emailid));
                    this.Label_Body.Text    = info.EmailContent;
                    this.Label_Subject.Text = info.Title;

                    DataTable To = BusinessSupply.BusinessOper.Email_PersonBusiness.GetEmail_PersonByEmailId(Convert.ToInt32(emailid));

                    string to = "";
                    foreach (DataRow dr in To.Rows)
                    {
                        to += dr["EmailAddress"].ToString() + ",";
                    }
                    this.Label_MessageTo.Text = to.Substring(0, to.Length - 1);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "alert('数据加载错误!')", true);
                }
            }
        }
示例#2
0
        public Autor(int id, TNomePessoa nome, TEmail email)
        {
            this.ImportarEstadoDeIntegridade(nome, email);

            if (this.EstaEmEstadoIntegro())
            {
                AutorId = id;
                Nome    = nome;
                Email   = email;
            }
        }
示例#3
0
 public static TEmail GetEmailById(int id)
 {
     try
     {
         TEmail email = TEmail.FindById(id);
         return(email);
     }
     catch
     {
         return(null);
     }
 }
示例#4
0
 //前科协代码
 //将需要的代码都放在上面,日后将一下代码全部删除
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public static TEmail AddEmail(int associationid, int createuserid, DateTime createtime, string title, string content)
 {
     try
     {
         TEmail newemail = new TEmail();
         newemail.AssociationId = associationid;
         newemail.CreateTime    = createtime;
         newemail.CreateUserId  = createuserid;
         newemail.EmailContent  = content;
         newemail.Title         = title;
         newemail.IsDel         = false;
         newemail.Save();
         return(newemail);
     }
     catch
     {
         return(null);
     }
 }
示例#5
0
        protected void btn_Send_Click(object sender, EventArgs e)
        {
            try
            {
                EmailAccount email = EmailAccountBusiness.GetEmailAccount(Convert.ToInt32(uid));
                if (email == null)
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "layer.alert('请先保存发件人的邮箱账号!')", true);
                    return;
                }
                SmtpClient client = new SmtpClient();
                client.Host = email.EmailServer;//"smtp.163.com";
                client.UseDefaultCredentials = false;
                //发件人邮箱账号、密码
                //client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "zpc0622wangyi");
                client.Credentials    = new System.Net.NetworkCredential(email.Account, email.Password);
                client.DeliveryMethod = SmtpDeliveryMethod.Network;

                //发件人地址、收件人地址

                MailMessage message = new MailMessage(email.Account, this.Label_MessageTo.Text.Trim());

                //string To = this.Label_MessageTo.Text.Trim();

                //message.To.Add(To);
                message.BodyEncoding = System.Text.Encoding.UTF8; //设置编码
                message.IsBodyHtml   = true;                      //设置正文为HTML格式
                message.Subject      = tb_Subject.Text.Trim();
                message.Body         = tb_Body.Text.Trim();
                client.Send(message);

                DateTime createtime = DateTime.Now;
                string   title      = tb_Subject.Text.Trim();
                string   content    = tb_Body.Text.Trim();
                //新建邮件数据库记录
                TEmail send_r = BusinessSupply.BusinessOper.EmailBusiness.AddEmail(0, Convert.ToInt32(uid), createtime, title, content);
                if (send_r != null)
                {
                    //写入邮件人收件人数据库记录
                    //收件人personmemberid
                    string[] temp_id = receiverid.Split(',');
                    //收件人email地址
                    string[] temp_emailadress = receiver.Split(',');
                    int      emailid          = send_r.Id;
                    for (int j = 0; j < temp_id.Length; j++)
                    {
                        if (temp_emailadress[j] != "")
                        {
                            string a = BusinessSupply.BusinessOper.Email_PersonBusiness.AddEmail_Person(emailid, Convert.ToInt32(temp_id[j]), temp_emailadress[j]);
                            if (a != "1")
                            {
                                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "alert('发送失败!')", true);
                                return;
                            }
                        }
                    }

                    ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "alert('发送成功!')", true);
                }
            }
            catch
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "alert('发送失败!')", true);
            }
        }