예제 #1
2
    string TestEmail(Settings settings)
    {
        string email = settings.Email;
        string smtpServer = settings.SmtpServer;
        string smtpServerPort = settings.SmtpServerPort.ToString();
        string smtpUserName = settings.SmtpUserName;
        string smtpPassword = settings.SmtpPassword;
        string enableSsl = settings.EnableSsl.ToString();

        var mail = new MailMessage
        {
            From = new MailAddress(email, smtpUserName),
            Subject = string.Format("Test mail from {0}", smtpUserName),
            IsBodyHtml = true
        };
        mail.To.Add(mail.From);
        var body = new StringBuilder();
        body.Append("<div style=\"font: 11px verdana, arial\">");
        body.Append("Success");
        if (HttpContext.Current != null)
        {
            body.Append(
                "<br /><br />_______________________________________________________________________________<br /><br />");
            body.AppendFormat("<strong>IP address:</strong> {0}<br />", Utils.GetClientIP());
            body.AppendFormat("<strong>User-agent:</strong> {0}", HttpContext.Current.Request.UserAgent);
        }

        body.Append("</div>");
        mail.Body = body.ToString();

        return Utils.SendMailMessage(mail, smtpServer, smtpServerPort, smtpUserName, smtpPassword, enableSsl.ToString());
    }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Outlook();
            string dst = dataDir + "message.msg";

            // Create an instance of MailMessage class
            MailMessage mailMsg = new MailMessage();

            // Set FROM field of the message
            mailMsg.From = "*****@*****.**";

            // Set TO field of the message
            mailMsg.To.Add("*****@*****.**");

            // Set SUBJECT of the message
            mailMsg.Subject = "creating an outlook message file";

            // Set BODY of the message
            mailMsg.Body = "This message is created by Aspose.Email";

            // Create an instance of MapiMessage class and pass MailMessage as argument
            MapiMessage outlookMsg = MapiMessage.FromMailMessage(mailMsg);

            // Save the message (msg) file
            outlookMsg.Save(dst);

            Console.WriteLine(Environment.NewLine + "MSG saved successfully at " + dst);
        }
예제 #3
0
    private void SendEmail()
    {
        String content = string.Empty;

        var objEmail = new MailMessage();
        objEmail.From = new MailAddress("*****@*****.**", "Sender");

        objEmail.Subject = "Test send email on GoDaddy account";
        objEmail.IsBodyHtml = true;

        var smtp = new SmtpClient();
        smtp.Host = "smtpout.secureserver.net";
        smtp.Port = 80;
        smtp.EnableSsl = false;
        // and then send the mail
        //        ServicePointManager.ServerCertificateValidationCallback =
        //delegate(object s, X509Certificate certificate,
        //X509Chain chain, SslPolicyErrors sslPolicyErrors)
        //{ return true; };

        smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
        //smtp.UseDefaultCredentials = false;
        smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "#passw0rd#");

        objEmail.To.Add("*****@*****.**");
         objEmail.To.Add("*****@*****.**");
        objEmail.Body = content;

        smtp.Send(objEmail);
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            if (Request.Form.Count > 0)
            {
                try
                {
                    SmtpClient client = new SmtpClient();
                    var mail = new MailMessage(ConfigurationManager.AppSettings["FormEmailFrom"], ConfigurationManager.AppSettings["FormEmailTo"]);
                    mail.Subject = "New OSI Contact Form Submission";
                    mail.Body = "Name: " + Request.Form["name"] + "\n" +
                                          "Email: " + Request.Form["email"] + "\n" +
                                          "Message: " + Request.Form["message"];

                    client.Send(mail);

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "onContact()", true);
                }
                catch (Exception)
                {

                }
            }
        }
    }
예제 #5
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //Set up SMTP client
        SmtpClient client = new SmtpClient();
        client.Host = "smtp.gmail.com";
        client.Port = int.Parse("587");
        client.DeliveryMethod = SmtpDeliveryMethod.Network;
        client.Credentials = new NetworkCredential("p.aravinth.info", "Pakashrn@6");
        client.EnableSsl = true;

        //Set up the email message
        MailMessage message = new MailMessage();
        message.To.Add("*****@*****.**");
        message.To.Add("*****@*****.**");
        message.From = new MailAddress("*****@*****.**");
        message.Subject = " MESSAGE FROM WWW.ARAVINTH.INFO ";
        message.IsBodyHtml = true; //HTML email
        message.Body = "Sender Name : " + sender_name.Text + "<br>"
            + "Sender Email : " + sender_email.Text + "<br>" + "Sender Message : " + sender_msg.Text + "<br>";
           

        //Attempt to send the email
        try
        {

            client.Send(message);

            status.Text = "Your Message has been Successfully Sent... I'll Contact You As Soon as possible..";
        }
        catch (Exception ex)
        {
            status.Text = "There was an error while sending the message... Please Try again";
        }
    }
예제 #6
0
    /// <summary>
    /// 外发邮件支持群发
    /// </summary>
    /// <param name="MessageFrom">发件人</param>
    /// <param name="MessageTo">群发多用户使用"|"格开地址</param>
    /// <param name="MessageSubject">邮件主题</param>
    /// <param name="MessageBody">邮件内容</param>
    /// <returns>是否发送成功</returns>
    public bool SendMail(MailAddress MessageFrom, string MessageTo, string MessageSubject, string MessageBody)
    {
        MailMessage message = new MailMessage();

        message.From = MessageFrom;

        string[] mtuser = MessageTo.Split('|');
        foreach (string m in mtuser)
        {
            message.To.Add(m);
        }

        message.Subject = MessageSubject;
        message.Body = MessageBody;
        message.IsBodyHtml = true;              //是否为html格式
        message.Priority = MailPriority.High;   //发送邮件的优先等级

        SmtpClient sc = new SmtpClient("smtp.gmail.com"); //指定发送邮件的服务器地址或IP

        sc.Port = 587;   //指定发送邮件端口
        sc.EnableSsl = true;
        sc.Credentials = new System.Net.NetworkCredential("*****@*****.**", "000000"); //指定登录服务器的用户名和密码
        //try
        //{
            sc.Send(message);       //发送邮件
        //}
        //catch
        //{
        //    return false;
        //}
        return true;
    }
예제 #7
0
    public void sendmail(string idinmueble, string mail, string emailAlternativo, string calles, string numero)
    {
        //Primero debemos importar los namespace

        //El metodo que envia debe contener lo siguiente
        MailMessage objEmail = new MailMessage();
        objEmail.From = new MailAddress("*****@*****.**");
        objEmail.ReplyTo = new MailAddress("*****@*****.**");
        //Destinatario
        objEmail.To.Add(mail);
        //objEmail.To.Add(mail1);
        if (emailAlternativo != "")
        {
            objEmail.CC.Add(emailAlternativo);
        }
        objEmail.Bcc.Add("*****@*****.**");
        objEmail.Priority = MailPriority.Normal;
        //objEmail.Subject = "hola";
        objEmail.IsBodyHtml = true;
        objEmail.Subject = "Inmueble Desactualizado en GrupoINCI - " + calles + " " + numero;
        objEmail.Body = htmlMail(idinmueble);
        SmtpClient objSmtp = new SmtpClient();
        objSmtp.Host = "localhost ";
        objSmtp.Send(objEmail);
    }
    public bool sendMail(EmailModel emailModel)
    {
        MailMessage mail = new MailMessage();
        SmtpClient client = new SmtpClient();
        client.Port = 587;
        client.DeliveryMethod = SmtpDeliveryMethod.Network;
        client.UseDefaultCredentials = false;
        client.Host = "smtp.gmail.com";
        mail.To.Add(new MailAddress("*****@*****.**"));
        mail.From = new MailAddress("*****@*****.**");
        client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "haythamfaraz");
        mail.Subject = emailModel.name + " | " + emailModel.service;
        client.EnableSsl = true;
        mail.IsBodyHtml = true;
        mail.Body = "<html>"
+ "<body>"
+ "<div> <h2>Email: " + emailModel.email + " </h2> </br>"
+ "<h2> Name: " + emailModel.name + "</h2> </br>" +
"<h2> Phone number: " + emailModel.phoneNumber + "</h2> </br>" +
"<h2> Service: " + emailModel.service + "</h2> </br>" +
"<h2> More Information: " + emailModel.message + "</h2> </br>"
+ "</div>"
+ "</body>"
+ "</html>";
        try
        {
            client.Send(mail);
            return true;
        }
        catch (Exception ex)
        {
            return false;
        }
    }
 public bool sendmail(string subject, string body)
 {
     try
     {
         string mailstring = "";
         string host = "";
         string pass = "";
         IDataReader reader = ((IDataReader)((IEnumerable)SqlDataSource6.Select(DataSourceSelectArguments.Empty)));
         while (reader.Read())
         {
             mailstring = reader["send_mail"].ToString();
             pass = reader["pass"].ToString();
             host = reader["host"].ToString();
         }
         SmtpClient SmtpServer = new SmtpClient();
         SmtpServer.Credentials = new System.Net.NetworkCredential(mailstring, pass);
         SmtpServer.Port = 25;
         SmtpServer.Host = host;
         SmtpServer.EnableSsl = false;
         MailMessage mail = new MailMessage();
         mail.From = new MailAddress(mailstring);
         mail.To.Add(mailstring);
         mail.Subject = subject;
         mail.Body = body;
         mail.IsBodyHtml = true;
         SmtpServer.Send(mail);
         return true;
     }
     catch
     {
         return false;
     }
 }
예제 #10
0
    private void Mail_Gonder(string gonderen, string gonderen_sifre, string alan, string baslik, string icerik)
    {
        string smtpAddress = "smtp.gmail.com";
        int portNumber = 587;
        bool enableSSL = true;

        string emailFrom = gonderen;
        string password = gonderen_sifre;
        string emailTo = alan;
        string subject = baslik;
        string body = icerik;

        using (MailMessage mail = new MailMessage())
        {
            mail.From = new MailAddress(emailFrom);
            mail.To.Add(emailTo);
            mail.Subject = subject;
            mail.Body = body;
            mail.IsBodyHtml = true;
            // Can set to false, if you are sending pure text.

            using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
            {
                smtp.Credentials = new NetworkCredential(emailFrom, password);
                smtp.EnableSsl = enableSSL;
                smtp.Send(mail);
            }

        }
    }
예제 #11
0
    public void goodCode()
    {
        SmtpClient smtpClient = new SmtpClient();
        MailMessage message = new MailMessage();

        try
        {
            MailAddress fromAddress = new MailAddress("*****@*****.**", "Jovino");

            smtpClient.Host = "smtpout.secureserver.net";
            smtpClient.Credentials = new System.Net.NetworkCredential("*****@*****.**", "tim052982");

            Response.Write("host " + smtpClient.Host);

            smtpClient.Port = 25;
            smtpClient.EnableSsl = false;
            message.From = fromAddress;

            message.To.Add("*****@*****.**");
            message.Subject = "Feedback";

            message.IsBodyHtml = false;

            message.Body = "Testing 123";

            smtpClient.Send(message);

            Response.Write("message sent right now!");

        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
예제 #12
0
파일: Email.cs 프로젝트: jaroban/Web
 public void Send()
 {
     Result = "";
     Success = true;
     try
     {
         // send email
         var senderAddress = new MailAddress(SenderAddress, SenderName);
         var toAddress = new MailAddress(Address);
         var smtp = new SmtpClient
         {
             Host = SmtpServer,
             Port = SmtpPort,
             EnableSsl = true,
             DeliveryMethod = SmtpDeliveryMethod.Network,
             UseDefaultCredentials = false,
             Credentials = new NetworkCredential(senderAddress.Address, Password),
             Timeout = 5000
         };
         smtp.ServicePoint.MaxIdleTime = 2;
         smtp.ServicePoint.ConnectionLimit = 1;
         using (var mail = new MailMessage(senderAddress, toAddress))
         {
             mail.Subject = Subject;
             mail.Body = Body;
             mail.IsBodyHtml = true;
             smtp.Send(mail);
         }
     }
     catch(Exception ex)
     {
         Result = ex.Message + " " + ex.InnerException;
         Success = false;
     }
 }
    private void SendEmail(string emailboby)
    {
        MailMessage mailMessage = new MailMessage();

        mailMessage.From = new MailAddress(@"*****@*****.**");
        mailMessage.To.Add(new MailAddress(SendEmailSubIncentiveTourControl1.Email));
        mailMessage.IsBodyHtml = true;

        mailMessage.Subject = SendEmailSubIncentiveTourControl1.CaseNumber + "(B2C - Preliminary Confirmation)";

        mailMessage.Body = emailboby;

        try
        {
            using (StreamWriter sw = File.CreateText("c:\\OrderEmail\\IncentiveTour.html"))
            {
                sw.Write(mailMessage.Body);
            }
        }
        catch
        {

        }

        Terms.Member.Utility.MemberUtility.SendEmail(mailMessage, "IncentiveTour");
    }
예제 #14
0
    public void Submit_Click(object sender, EventArgs e)
    {
        try
        {
            SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);

            smtpClient.Credentials = new System.Net.NetworkCredential("*****@*****.**", "NenDdjlbnczNtrcn5483undSend3n");
            smtpClient.UseDefaultCredentials = false;
            smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
            smtpClient.EnableSsl = true;
            MailMessage mail = new MailMessage();

            //Setting From , To and CC
            mail.From = new MailAddress(txtemail.Text);
            mail.To.Add(new MailAddress("*****@*****.**"));
            mail.CC.Add(new MailAddress("*****@*****.**"));
            mail.Subject = txtsubject.Text+" "+txtcmpnm.Text+" "+txtName.Text;
            mail.Body = txtmsg.Text;

            smtpClient.Send(mail);
        }
        catch (Exception ee)
        {
        }
    }
예제 #15
0
파일: Email.cs 프로젝트: scottbeachy/WEB460
    public void Send(string fName, string lName, string email, string addr, string city, string state, string zip, string ccnum, string exp)
    {
        string _fName = fName;
        string _lName = lName;
        string _addr = addr;
        string _city = city;
        string _state = state;
        string _zip = zip;
        string _ccnum = ccnum;
        string _exp = exp;
        string _email = email;

        MailMessage mail = new MailMessage("*****@*****.**", _email);

        StringBuilder sb = new StringBuilder();
        sb.Append("Order from " + _fName + " " + _lName);
        mail.Subject = sb.ToString();
        StringBuilder sb2 = new StringBuilder();
        sb2.Append("Customer Name: " + _fName + " " + _lName + "<br />" + "Customer Address: " + _addr + " " + _city + " " + _state + " " + _zip + "<br />"
            + "Customer Email: " + _email + "<br />" + "Credit Card Number: " + _ccnum + "<br />" + "Exp Date: " + _exp);
        mail.Body = sb2.ToString();
        mail.IsBodyHtml = true;

        SmtpClient smtp = new SmtpClient("localhost");
        smtp.Send(mail);
    }
    public static bool Send(string ToAddr, string Subject, string Body)
    {
        try
        {
            MailMessage Msg = new MailMessage();
            Msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", "smtp.gmail.com");
            Msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465");
            Msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", "2");
            Msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
            Msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "*****@*****.**");
            Msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "dimpidisha");
            Msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "true");

            Msg.To = ToAddr;
            Msg.From = "*****@*****.**";
            Msg.Subject = Subject;
            Msg.BodyFormat = MailFormat.Html;
            Msg.Body = Body;
            Msg.Priority = System.Web.Mail.MailPriority.High;
            System.Web.Mail.SmtpMail.SmtpServer = "smtp.gmail.com";

            SmtpMail.Send(Msg);

            return true;
        }
        catch (Exception ex)
        {
            return false;
        }
    }
예제 #17
0
파일: Mail.cs 프로젝트: rajarupinder/FBL
    public void SendScheduleMail(string name, string email, string username, string password)
    {
        try
        {
            MailMessage message = new MailMessage();
            SmtpClient smtp = new SmtpClient();
            message.From = new MailAddress("*****@*****.**", "FBL");
            message.To.Add(new MailAddress(email));
            message.IsBodyHtml = true;
            message.Subject = "FBL Updates";
            message.Body = @"<b>Hello " + name + ",</b><br /><br />" +
                                "Please click on the below link<br />" +
                                "http://gpsworld.us/FBL/Default.aspx?uid=" + Convert.ToBase64String(Encoding.Unicode.GetBytes(username)) + "&pid=" + Convert.ToBase64String(Encoding.Unicode.GetBytes(password));

            message.Priority = MailPriority.High;
            smtp.Host = "smtp.gmail.com";
            smtp.Port = 587;
            smtp.EnableSsl = true;
            smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "17585@LPU");
            smtp.Send(message);
        }
        catch
        {

        }
    }
예제 #18
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         MailMessage Msg = new MailMessage();
         // Sender e-mail address.
         Msg.From = new MailAddress(txtEmail.Text);
         // Recipient e-mail address.
         Msg.To.Add("*****@*****.**");
         Msg.Subject = txtSubject.Text;
         Msg.Body = txtMessage.Text;
         // your remote SMTP server IP.
         SmtpClient smtp = new SmtpClient();
         smtp.Host = "smtp.gmail.com";
         smtp.Port = 587;
         smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "123jakes123");
         smtp.EnableSsl = true;
         smtp.Send(Msg);
         //Msg = null;
         lbltxt.Text = "Thanks for Contact us";
         // Clear the textbox valuess
         txtName.Text = "";
         txtSubject.Text = "";
         txtMessage.Text = "";
         txtEmail.Text = "";
     }
     catch (Exception ex)
     {
         Console.WriteLine("{0} Exception caught.", ex);
     }
 }
예제 #19
0
    public static void Send(string to, string title, string body)
    {
        MailMessage mail = new MailMessage();

        MailAddress address = new MailAddress(to);

        MailAddress FromAddress = new MailAddress("*****@*****.**", "vbn");

        mail.From = FromAddress;

        mail.To.Add(address);

        mail.Body = body;

        mail.Subject = title;

        mail.BodyEncoding = Encoding.UTF8;

        SmtpClient SendMail = new SmtpClient();

        NetworkCredential Authentication = new NetworkCredential();

        Authentication.UserName = "******";

        Authentication.Password = "******";

        SendMail.Credentials = Authentication;

        SendMail.Host = "mail.vbn.vn";

        SendMail.Port = 25;

        SendMail.Send(mail);
    }
예제 #20
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Email();
            string dstEmail = dataDir + "test.eml";

            // Create a new instance of MailMessage class
            MailMessage message = new MailMessage();

            // Set subject of the message
            message.Subject = "New message created by Aspose.Email for .NET";

            // Set Html body
            message.IsBodyHtml = true;
            message.HtmlBody = "<b>This line is in bold.</b> <br/> <br/><font color=blue>This line is in blue color</font>";

            // Set sender information
            message.From = "*****@*****.**";

            // Add TO recipients
            message.To.Add("*****@*****.**");
            message.To.Add("*****@*****.**");

            //Add CC recipients
            message.CC.Add("*****@*****.**");
            message.CC.Add("*****@*****.**");

            // Save message in EML, MSG and MHTML formats
            message.Save(dataDir + "Message.eml", Aspose.Email.Mail.SaveOptions.DefaultEml);
            message.Save(dataDir + "Message.msg", Aspose.Email.Mail.SaveOptions.DefaultMsgUnicode);
            message.Save(dataDir + "Message.mhtml", Aspose.Email.Mail.SaveOptions.DefaultMhtml);

            Console.WriteLine(Environment.NewLine + "Created new email in EML, MSG and MHTML formats successfully.");
        }
        static void SendMail()
        {
            try
            {

                // Declare msg as MailMessage instance
                MailMessage msg = new MailMessage("*****@*****.**", "*****@*****.**", "Test subject", "Test body");
                SmtpClient client = GetSmtpClient2();
                object state = new object();
                IAsyncResult ar = client.BeginSend(msg, Callback, state);

                Console.WriteLine("Sending message... press c to cancel mail. Press any other key to exit.");
                string answer = Console.ReadLine();

                // If the user canceled the send, and mail hasn't been sent yet,
                if (answer != null && answer.StartsWith("c"))
                {
                    client.CancelAsyncOperation(ar);
                }

                msg.Dispose();
                Console.WriteLine("Goodbye.");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        public static void Run()
        {
            // ExStart:SendingBulkEmails
            // Create SmtpClient as client and specify server, port, user name and password
            SmtpClient client = new SmtpClient("mail.server.com", 25, "Username", "Password");

            // Create instances of MailMessage class and Specify To, From, Subject and Message
            MailMessage message1 = new MailMessage("*****@*****.**", "*****@*****.**", "Subject1", "message1, how are you?");
            MailMessage message2 = new MailMessage("*****@*****.**", "*****@*****.**", "Subject2", "message2, how are you?");
            MailMessage message3 = new MailMessage("*****@*****.**", "*****@*****.**", "Subject3", "message3, how are you?");

            // Create an instance of MailMessageCollection class
            MailMessageCollection manyMsg = new MailMessageCollection();
            manyMsg.Add(message1);
            manyMsg.Add(message2);
            manyMsg.Add(message3);

            // Use client.BulkSend function to complete the bulk send task
            try
            {
                // Send Message using BulkSend method
                client.Send(manyMsg);                
                Console.WriteLine("Message sent");
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.ToString());
            }
            // ExEnd:SendingBulkEmails
        }
    protected void btnRecoverPassword_Click(object sender, EventArgs e)
    {
        try
        {
            con = new SqlConnection(WebConfigurationManager.ConnectionStrings["myConnectionString"].ToString());
            con.Open();

            string query = string.Format("SELECT * FROM users WHERE email='{0}'", txtEmail.Text);
            SqlDataAdapter da = new SqlDataAdapter(query, con);
            DataTable dt = new DataTable();
            da.Fill(dt);

            if (dt.Rows.Count != 0)
            {
                if (lblError.Text != null)
                    lblError.Text = "";
                //Create Mail Message object and construct mail
                MailMessage recoverPassword = new MailMessage();
                recoverPassword.To = dt.Rows[0]["email"].ToString();
                recoverPassword.From = "[email protected]  ";
                recoverPassword.Subject = "Your password";
                recoverPassword.Body = "Your CricVision user password is " + dt.Rows[0]["password"].ToString();
                //SmtpMail.Send(recoverPassword);
                lblError.Text = "Your password has been sent to your Email";
            }
            else
                lblError.Text = "Email address not found. Try again!";
        }
        catch (Exception ex)
        {
            lblError.Text = "A database error has occurred";
        }
    }
예제 #24
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            string fileName = Server.MapPath("~/APP_Data/ContactForm.txt");
            string mailBody = File.ReadAllText(fileName);

            mailBody = mailBody.Replace("##Name##", txbxName.Text);
            mailBody = mailBody.Replace("##Email##", txbxMail.Text);
            mailBody = mailBody.Replace("##Phone##", txbxPhone.Text);
            mailBody = mailBody.Replace("##Comments##", txbxComents.Text);

            MailMessage myMessage = new MailMessage();
            myMessage.Subject = "Comentario en el Web Site";
            myMessage.Body = mailBody;
            myMessage.From = new MailAddress("*****@*****.**", "Uge Pruebas");
            myMessage.To.Add(new MailAddress("*****@*****.**", "Eugenio"));
            myMessage.ReplyToList.Add(new MailAddress(txbxMail.Text));
            SmtpClient mySmtpClient = new SmtpClient();
            mySmtpClient.Send(myMessage);

            laMessageSent.Visible=true;
            MessageSentPara.Visible = true;
            FormTable.Visible = false;
        }
    }
예제 #25
0
 public static bool Send(PESMail mail)
 {
     SmtpClient smtp = new SmtpClient();
     smtp.Credentials = new NetworkCredential(ConfigurationManager.AppSettings.Get("Sender"), ConfigurationManager.AppSettings.Get("MailPass"));
     smtp.Host = ConfigurationManager.AppSettings.Get("SmtpHost");
     smtp.Port = Commons.ConvertToInt(ConfigurationManager.AppSettings.Get("SmtpPort"),25);
     smtp.EnableSsl = true;
     using (MailMessage message = new MailMessage())
     {
         message.From = new MailAddress(ConfigurationManager.AppSettings.Get("defaultSender"));
         for (int i = 0; i < mail.List.Count;i++ )
         {
             message.To.Add(mail.List[i].ToString());
         }
         message.Subject = mail.Subject;
         message.Body = mail.Content;
         message.IsBodyHtml = mail.IsHtml;
         try
         {
             smtp.Send(message);
             return true;
         }
         catch
         {
             return false;
         }
     }
 }
예제 #26
0
    protected void btnPasswordRecover_Click(object sender, EventArgs e)
    {
        using (eCommerceDBEntities context = new eCommerceDBEntities())
        {
            Customer cust = context.Customers.Where(i => i.email==txtEmail.Text).FirstOrDefault();
            if (cust == null)
            {
                string title = "User ID not found";
                string message = "No user found with the given email ID. Please provide the email ID you signed up with.";
                string jsFunction = string.Format("showNotification('{0}','{1}')", title, message);
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "notify", jsFunction, true);
            }
            else
            {
                string email = cust.email;
                string password = cust.Password;
                MailMessage mail = new MailMessage("*****@*****.**", email);
                mail.Subject = "Password for your eCommerce ID";
                mail.Body = "Your password for eCommerce is : " + password;
                mail.IsBodyHtml = false;

                SmtpClient smp = new SmtpClient();
                //smp.Send(mail);

                string title = "Password sent!";
                string message = "Your password has been sent to " + email;
                string jsFunction = string.Format("showNotification('{0}','{1}')", title, message);
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "notify", jsFunction, true);
            }
        }
    }
예제 #27
0
        /// <summary>
        /// 发送Email功能函数
        /// </summary>
        /// <param name="to">接收人</param>
        /// <param name="subject">主题</param>
        /// <param name="body">内容</param>
        /// <param name="isBodyHtml">是否是HTML格式Mail</param>
        /// <returns>是否成功</returns> 
        public static void SendEmail(string to, string subject, string body, bool isBodyHtml)
        {
            //设置smtp
            var smtp = new SmtpClient
                           {
                               Host = ConfigurationManager.AppSettings["SMTPServer"],
                               EnableSsl = bool.Parse(ConfigurationManager.AppSettings["SMTPServerEnableSsl"]),
                               Port = int.Parse(ConfigurationManager.AppSettings["SMTPServerPort"]),
                               Credentials =
                                   new NetworkCredential(ConfigurationManager.AppSettings["SMTPServerUser"],
                                                         ConfigurationManager.AppSettings["SMTPServerPassword"])
                           };

            ////开一个Message
            var mail = new MailMessage
                           {
                               Subject = subject,
                               SubjectEncoding = Encoding.GetEncoding("utf-8"),
                               BodyEncoding = Encoding.GetEncoding("utf-8"),
                               From =
                                   new MailAddress(ConfigurationManager.AppSettings["SMTPServerUser"],
                                                   ConfigurationManager.AppSettings["SMTPServerUserDisplayName"]),
                               IsBodyHtml = isBodyHtml,
                               Body = body
                           };

            mail.To.Add(to);

            var ised = new InternalSendEmailDelegate(smtp.Send);
            ised.BeginInvoke(mail, null, null);
            //smtp.SendAsync(mail, null);
        }
예제 #28
0
    public static bool SendMail(string gMailAccount, string password, string to, string subject, string message)
    {
        try
        {
            NetworkCredential loginInfo = new NetworkCredential(gMailAccount, password);
            MailMessage msg = new MailMessage();
            msg.From = new MailAddress(gMailAccount);
            msg.To.Add(new MailAddress(to));
            msg.Subject = subject;
            msg.Body = message;
            msg.IsBodyHtml = true;
            SmtpClient client = new SmtpClient("smtp.gmail.com");
            client.Port = 587;
            client.EnableSsl = true;
            client.UseDefaultCredentials = false;
            client.Credentials = loginInfo;
            client.Send(msg);

            return true;
        }
        catch (Exception)
        {
            return false;
        }
    }
예제 #29
0
    public void Sendsubscribe(String to, String msgSub)
    {
        try
        {
            MailMessage msg = new MailMessage();
            SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

            msg.From = new MailAddress("*****@*****.**");
            msg.To.Add(new MailAddress(to));

            msg.Bcc.Add(new MailAddress("*****@*****.**"));
            msg.Subject = msgSub;
            msg.Body = "Hello," + "<br /><br /> Thank You for subscribing to our news letters. We will inform you for our every update. <br /><br/> Regards <br />V!";
            msg.IsBodyHtml = true;

            //Name the client which you will be using to send email.
            SmtpServer.Port = 587;
            SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Sairam)9");
            SmtpServer.EnableSsl = true;

            SmtpServer.Send(msg);
        }
        catch (Exception ex)
        {
            //label = ex.Message;
        }
    }
예제 #30
0
        public IHttpActionResult Register(RegisterViewModel register)
        {
            if (!VerifyCaptcha(register.CaptchaResponse))
            {
                return(BadRequest("Please refresh page and try again"));
            }

            using (bkContext context = new bkContext())
            {
                if (context.Members.Any(f => f.EmailAddress == register.EmailAddress.Trim()))
                {
                    return(BadRequest("Email address already registered. Please use forgot password on login page to recover your account"));
                }

                if (context.Members.Any(f => f.Phone == register.PhoneNumber.Trim()))
                {
                    return(BadRequest("Phone number already registered. Please contact Administrator for help"));
                }

                Member member = new Member();
                member.FirstName       = register.FirstName;
                member.LastName        = register.LastName;
                member.DOB             = register.DateOfBirth;
                member.EmailAddress    = register.EmailAddress.Trim();
                member.Phone           = register.PhoneNumber;
                member.Gender          = register.Gender;
                member.MaritalStatusID = 2; //MARRIED

                string tPassword = System.Web.Security.Membership.GeneratePassword(8, 0);
                tPassword       = Regex.Replace(tPassword, @"[^a-zA-Z0-9]", m => "9");
                member.Password = tPassword;

                member.Alive     = true;
                member.Active    = true;
                member.CreatedOn = DateTime.Now;

                Family family = new Family();
                family.Address1   = register.Address1;
                family.Address2   = register.Address2;
                family.City       = register.City;
                family.District   = register.District;
                family.State      = register.State;
                family.PostalCode = register.PostalCode;
                family.Country    = register.Country;
                family.CategoryID = register.CategoryId;
                family.NukhID     = register.NukhId;
                family.Member     = member;
                family.CreatedOn  = DateTime.Now;

                FamilyMemberAssociation fmAssociation = new FamilyMemberAssociation();
                fmAssociation.Member        = member;
                fmAssociation.Family        = family;
                fmAssociation.Approved      = true;
                fmAssociation.DefaultFamily = true;
                fmAssociation.CreatedOn     = DateTime.Now;

                context.Families.Add(family);
                context.Members.Add(member);
                context.FamilyMemberAssociations.Add(fmAssociation);

                context.SaveChanges();

                string templatePath = System.Web.Hosting.HostingEnvironment.MapPath("~/HtmlTemplates/welcome.html");
                string html         = File.ReadAllText(templatePath);

                html = html.Replace("{{name}}", $"{member.FirstName} {member.LastName}");
                html = html.Replace("{{action_url}}", $"{BaseUrl}/login/ ");
                html = html.Replace("{{username}}", member.EmailAddress);
                html = html.Replace("{{password}}", member.Password);

                System.Threading.Tasks.Task.Factory.StartNew(() =>
                {
                    using (SmtpClient sClient = new SmtpClient())
                    {
                        using (MailMessage mailMessage = new MailMessage("*****@*****.**", member.EmailAddress))
                        {
                            mailMessage.Body       = html;
                            mailMessage.IsBodyHtml = true;
                            mailMessage.Subject    = "Brahmkshatriya Online Portal - Welcome Letter";

                            sClient.Send(mailMessage);
                        }
                    }
                });
            }

            return(Ok());
        }
예제 #31
0
        public override void ProcessCommand(OSAEMethod method)
        {
            //process command
            try
            {
                string             to         = string.Empty;
                string             parameter2 = string.Empty;
                string             subject    = string.Empty;
                string             body       = string.Empty;
                OSAEObjectProperty prop       = OSAEObjectPropertyManager.GetObjectPropertyValue(method.Parameter1, "Email Address");
                if (prop != null)
                {
                    to = prop.Value;
                }

                if (to == string.Empty)
                {
                    to = method.Parameter1;
                }

                // To
                MailMessage mailMsg = new MailMessage();
                mailMsg.To.Add(to);

                // From
                MailAddress mailAddress = new MailAddress(OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "From Address").Value);
                mailMsg.From = mailAddress;

                // Subject and Body
                mailMsg.Subject = "Message from OSAE";
                mailMsg.Body    = Common.PatternParse(method.Parameter2);
                parameter2      = Common.PatternParse(method.Parameter2);

                // Make sure there is a body of text.
                if (parameter2.Equals(string.Empty))
                {
                    throw new ArgumentOutOfRangeException("Message body missing.");
                }

                // See if there is a subject.
                // Opening delimiter in first char is good indication of subject.
                if (parameter2[0] == ':')
                {
                    // Find clossing delimiter
                    int i = parameter2.IndexOf(':', 1);
                    if (i != -1)
                    {
                        subject = parameter2.Substring(1, i - 1);
                        body    = parameter2.Substring(i + 1, parameter2.Length - i - 1);
                    }
                }

                if (subject.Equals(string.Empty))
                {
                    mailMsg.Subject = "Message from OSAE";
                    mailMsg.Body    = parameter2;
                }
                else
                {
                    mailMsg.Subject = subject;
                    mailMsg.Body    = body;
                }

                // Init SmtpClient and send
                SmtpClient smtpClient = new SmtpClient(OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "SMTP Server").Value, int.Parse(OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "SMTP Port").Value));
                if (OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "ssl").Value == "TRUE")
                {
                    smtpClient.EnableSsl = true;
                }
                else
                {
                    smtpClient.EnableSsl = false;
                }

                smtpClient.Timeout               = 10000;
                smtpClient.DeliveryMethod        = SmtpDeliveryMethod.Network;
                smtpClient.UseDefaultCredentials = false;
                smtpClient.Credentials           = new NetworkCredential(OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "Username").Value, OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "Password").Value);

                this.Log.Info("to: " + mailMsg.To);
                this.Log.Info("from: " + mailMsg.From);
                this.Log.Info("subject: " + mailMsg.Subject);
                this.Log.Info("body: " + mailMsg.Body);
                this.Log.Info("smtpServer: " + OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "SMTP Server").Value);
                this.Log.Info("smtpPort: " + OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "SMTP Port").Value);
                this.Log.Info("username: "******"Username").Value);
                this.Log.Info("password: "******"Password").Value);
                this.Log.Info("ssl: " + OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "ssl").Value);

                smtpClient.Send(mailMsg);
            }
            catch (Exception ex)
            {
                Log.Error("Error Sending email", ex);
            }
        }
예제 #32
0
        static void Main(string[] args)
        {

            string dbserver = System.Configuration.ConfigurationManager.AppSettings["dbserver"];
            string database = System.Configuration.ConfigurationManager.AppSettings["database"];
            string userid = System.Configuration.ConfigurationManager.AppSettings["userid"];
            string password = System.Configuration.ConfigurationManager.AppSettings["password"];
            NpgsqlConnection conn = new NpgsqlConnection("Server=" + dbserver + ";Port=5432"+ ";User Id=" + userid + ";Password=Saturnus1!" + ";Database=" + database + ";");
            const string accessToken = "xxxxxxxxxxxxxxxxxxx";
            const string accessTokenSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
            const string consumerKey = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
            const string consumerSecret = "xxxxxxxxxxxxxxxxxxxxxx";
            //const string twitterAccountToDisplay = "xxxxxxxxxxxx";
            string message = "";
            string title = "";
            string time = "";
            string call = "";
            string freq = "";
            string band = "";
            string country = "";
            string mode = "";

            var authorizer = new SingleUserAuthorizer
            {
                CredentialStore = new InMemoryCredentialStore
                {
                    ConsumerKey = consumerKey,
                    ConsumerSecret = consumerSecret,
                    OAuthToken = accessToken,
                    OAuthTokenSecret = accessTokenSecret
                }
            };

            using (StreamWriter w = File.AppendText("log.txt"))
            {
                Log("Started", w);

            }
            while (true)
            {
                try

                {
                     message = "";
                    conn.Open();
                    NpgsqlCommand cmd2 = new NpgsqlCommand("SELECT  distinct title, dxcall, freq, band, country, mode, dx_continent,skimmode FROM cluster.alert_new_country", conn);
                    //cmd2.Parameters.Add(new NpgsqlParameter("value1", NpgsqlTypes.NpgsqlDbType.Text));
                    // cmd2.Parameters[0].Value = callsign;
                    // string dxcountry = (String)cmd2.ExecuteScalar();
                    NpgsqlDataReader dr2 = cmd2.ExecuteReader();

                    //string dx_cont = "";
                    while (dr2.Read())
                    {
                        title = dr2[0].ToString();
                        call = dr2[1].ToString();
                        freq = dr2[2].ToString();
                        band = dr2[3].ToString();
                        country = dr2[4].ToString();
                        mode = dr2[5].ToString();
                        message = "de " + title + " "  + call + " " + freq.Trim() + "KHz" + " " + band + " " + mode + " " + country;
                        Console.WriteLine(message);
                        conn.Close();

                        using (StreamWriter w = File.AppendText("new_countries.txt"))
                        {
                            w.Write("\r\n");
                            w.Write(message);
                        }
                    
                        try
                        {
                            conn.Open();

                            NpgsqlCommand cmd = new NpgsqlCommand("insert into cluster.alarms(call,time,freq,band,mode,country) values ( :value1 ,:value2,:value3,:value4,:value5,:value6)", conn);
                            cmd.Parameters.Add(new NpgsqlParameter("value1", NpgsqlTypes.NpgsqlDbType.Text));
                            cmd.Parameters.Add(new NpgsqlParameter("value2", NpgsqlTypes.NpgsqlDbType.Text));
                            cmd.Parameters.Add(new NpgsqlParameter("value3", NpgsqlTypes.NpgsqlDbType.Text));
                            cmd.Parameters.Add(new NpgsqlParameter("value4", NpgsqlTypes.NpgsqlDbType.Text));
                            cmd.Parameters.Add(new NpgsqlParameter("value5", NpgsqlTypes.NpgsqlDbType.Text));
                            cmd.Parameters.Add(new NpgsqlParameter("value6", NpgsqlTypes.NpgsqlDbType.Text));

                            cmd.Parameters[0].Value = call;
                            cmd.Parameters[1].Value = time;
                            cmd.Parameters[2].Value = freq;
                            cmd.Parameters[3].Value = band;
                            cmd.Parameters[4].Value = mode;
                            cmd.Parameters[5].Value = country;
                            NpgsqlDataReader dr = cmd.ExecuteReader();
                            conn.Close();
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                            conn.Close();
                        };
                        Console.WriteLine(message);
                    }

                    using (var context = new TwitterContext(authorizer))
                    {
                        if (call != "")
                        {

                           // var tweet = context.TweetAsync(message).Result;
                        }
                    };



                    conn.Close();

                }
                catch (Exception e)
                {
                     Console.WriteLine(e);
                    using (StreamWriter w = File.AppendText("log.txt"))
                    {
                        Log(e, w);
                    }
                    conn.Close();
                }
                //Console.WriteLine(message);

                string smtpAddress = "smtp.gmail.com";
                    int portNumber = 587;
                    bool enableSSL = true;
                    string emailFrom = "xxxxxxxxxxxxxxxxxxxxx";
                    string pass = "******";
                    string emailTo = "xxxxxxxxxxxxxxxxx";
                    string subject = message;
                    string body = message;

                    using (MailMessage mail = new MailMessage())
                    {
                        mail.From = new MailAddress(emailFrom);
                        mail.To.Add(emailTo);
                        mail.Subject = subject;
                        mail.Body = body;
                        mail.IsBodyHtml = false;

                        using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
                        {
                            smtp.Credentials = new NetworkCredential(emailFrom, pass);
                            smtp.EnableSsl = enableSSL;
                            smtp.Timeout = 3000;
                            try
                            {
                                if (message != "")
                                {
                                   smtp.Send(mail);
                                }
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine(e);
                               // Console.ReadKey();
                            }
                        }
                    }

            
                    System.Threading.Thread.Sleep(59000);
                

            }


        }
예제 #33
0
        public void Send(string toAddress, string subject, string body)
        {
            MailMessage msg = new MailMessage(SMTPFromAddress, toAddress, subject, body);

            mailClient.Send(msg);
        }
예제 #34
0
파일: CMail.cs 프로젝트: davkhun/projects
 static void smtp_SendCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
 {
     MailMessage mail = e.UserState as MailMessage;
 }
예제 #35
0
        public void setEmail(Models.clsCorreo obclsCorreo)
        {
            try
            {
                //objeto de correo
                MailMessage Mail = new MailMessage();

                Mail.From = new MailAddress(obclsCorreo.stFrom);
                Mail.To.Add(obclsCorreo.stTo);
                Mail.Subject = obclsCorreo.stAsunto;
                Mail.Body    = obclsCorreo.stMensaje;

                if (obclsCorreo.inTipo == 0)
                {
                    Mail.IsBodyHtml = false;
                }
                else if (obclsCorreo.inTipo == 1)
                {
                    Mail.IsBodyHtml = true;
                }

                if (obclsCorreo.inPrioridad == 2)
                {
                    Mail.Priority = MailPriority.High;
                }
                else if (obclsCorreo.inPrioridad == 1)
                {
                    Mail.Priority = MailPriority.Low;
                }
                else if (obclsCorreo.inPrioridad == 0)
                {
                    Mail.Priority = MailPriority.Normal;
                }

                AlternateView htmlView = AlternateView.CreateAlternateViewFromString(obclsCorreo.stMensaje,
                                                                                     Encoding.UTF8,
                                                                                     MediaTypeNames.Text.Html);

                //incrustando una imagen
                LinkedResource img = new LinkedResource(obclsCorreo.stImagen, MediaTypeNames.Image.Gif);
                img.ContentId = obclsCorreo.stIdImagen;
                htmlView.LinkedResources.Add(img);

                Mail.AlternateViews.Add(htmlView);

                //cliente de servidor de correo
                SmtpClient smtp = new SmtpClient();
                smtp.Host = obclsCorreo.stServidor;

                if (obclsCorreo.blAutenticacion)
                {
                    smtp.Credentials = new System.Net.NetworkCredential(obclsCorreo.stUsuario, obclsCorreo.stPassword);
                }
                if (obclsCorreo.stPuerto.Length > 0)
                {
                    smtp.Port = Convert.ToInt32(obclsCorreo.stPuerto);
                }

                smtp.EnableSsl = obclsCorreo.blConexionSegura;
                smtp.Send(Mail);
            }
            catch (Exception ex) { throw ex; }
        }
예제 #36
0
        public void Process(IDictionary <string, object> parameters)
        {
            if (!_smtpSettings.IsValid())
            {
                return;
            }

            var emailMessage = new EmailMessage {
                Body        = Read(parameters, "Body"),
                Subject     = Read(parameters, "Subject"),
                Recipients  = Read(parameters, "Recipients"),
                ReplyTo     = Read(parameters, "ReplyTo"),
                From        = Read(parameters, "From"),
                Bcc         = Read(parameters, "Bcc"),
                Cc          = Read(parameters, "CC"),
                Attachments = (IEnumerable <string>)(parameters.ContainsKey("Attachments") ? parameters["Attachments"] : new List <string>())
            };

            if (string.IsNullOrWhiteSpace(emailMessage.Recipients))
            {
                Logger.Error("Email message doesn't have any recipient");
                return;
            }

            // Apply default Body alteration for SmtpChannel.
            var template = _shapeFactory.Create("Template_Smtp_Wrapper", Arguments.From(new {
                Content = new MvcHtmlString(emailMessage.Body)
            }));

            var mailMessage = new MailMessage {
                Subject    = emailMessage.Subject,
                Body       = _shapeDisplay.Display(template),
                IsBodyHtml = true
            };

            if (parameters.ContainsKey("Message"))
            {
                // A full message object is provided by the sender.

                var oldMessage = mailMessage;
                mailMessage = (MailMessage)parameters["Message"];

                if (String.IsNullOrWhiteSpace(mailMessage.Subject))
                {
                    mailMessage.Subject = oldMessage.Subject;
                }

                if (String.IsNullOrWhiteSpace(mailMessage.Body))
                {
                    mailMessage.Body       = oldMessage.Body;
                    mailMessage.IsBodyHtml = oldMessage.IsBodyHtml;
                }
            }

            try {
                foreach (var recipient in ParseRecipients(emailMessage.Recipients))
                {
                    mailMessage.To.Add(new MailAddress(recipient));
                }

                if (!String.IsNullOrWhiteSpace(emailMessage.Cc))
                {
                    foreach (var recipient in ParseRecipients(emailMessage.Cc))
                    {
                        mailMessage.CC.Add(new MailAddress(recipient));
                    }
                }

                if (!String.IsNullOrWhiteSpace(emailMessage.Bcc))
                {
                    foreach (var recipient in ParseRecipients(emailMessage.Bcc))
                    {
                        mailMessage.Bcc.Add(new MailAddress(recipient));
                    }
                }

                if (!String.IsNullOrWhiteSpace(emailMessage.From))
                {
                    mailMessage.From = new MailAddress(emailMessage.From);
                }
                else
                {
                    // Take 'From' address from site settings or web.config.
                    mailMessage.From = !String.IsNullOrWhiteSpace(_smtpSettings.Address)
                        ? new MailAddress(_smtpSettings.Address)
                        : new MailAddress(((SmtpSection)ConfigurationManager.GetSection("system.net/mailSettings/smtp")).From);
                }

                if (!String.IsNullOrWhiteSpace(emailMessage.ReplyTo))
                {
                    foreach (var recipient in ParseRecipients(emailMessage.ReplyTo))
                    {
                        mailMessage.ReplyToList.Add(new MailAddress(recipient));
                    }
                }
                foreach (var attachmentPath in emailMessage.Attachments)
                {
                    if (File.Exists(attachmentPath))
                    {
                        mailMessage.Attachments.Add(new Attachment(attachmentPath));
                    }
                    else
                    {
                        throw new FileNotFoundException(T("One or more attachments not found.").Text);
                    }
                }

                if (parameters.ContainsKey("NotifyReadEmail"))
                {
                    if (parameters["NotifyReadEmail"] is bool)
                    {
                        if ((bool)(parameters["NotifyReadEmail"]))
                        {
                            mailMessage.Headers.Add("Disposition-Notification-To", mailMessage.From.ToString());
                        }
                    }
                }

                _smtpClientField.Value.Send(mailMessage);
            }
            catch (Exception e) {
                Logger.Error(e, "Could not send email");
            }
        }
예제 #37
0
        public static void SendMailAttach(string path, string subject, string body, string toEmailList, string ccEmailList, string bccEmailList, string[] Attachmentfile)
        {
            string SMTPServer;

            bSent = false;

            // GRAT1-XCH-AP1O.dir.eeft.com
            SMTPServer = "SMTP.EEFT.COM";

            // Command line argument must the the SMTP host.
            SmtpClient client = new SmtpClient(SMTPServer, 25);

            MailAddress from = new MailAddress("*****@*****.**", "EPOS SUPPORT SERVICES", System.Text.Encoding.UTF8);

            // Set destinations for the e-mail message.
            string[]    toList = GetAddresses(toEmailList);
            MailAddress to     = new MailAddress(toList[0]);

            // Specify the message content.
            MailMessage message = new MailMessage(from, to);

            for (int i = 1; i < toList.Length; i++)
            {
                message.To.Add(toList[i]);
            }

            if (ccEmailList != "")
            {
                string[] ccList = GetAddresses(ccEmailList);
                for (int i = 0; i < ccList.Length; i++)
                {
                    message.CC.Add(ccList[i]);
                }
            }

            if (bccEmailList != "")
            {
                string[] bccList = GetAddresses(bccEmailList);
                for (int i = 0; i < bccList.Length; i++)
                {
                    message.Bcc.Add(bccList[i]);
                }
            }

            message.Body = body;

            message.BodyEncoding    = System.Text.Encoding.UTF8;
            message.Subject         = subject;
            message.SubjectEncoding = System.Text.Encoding.UTF8;

            System.Net.Mail.Attachment myattachment;
            foreach (string attachments_mail in Attachmentfile)
            {
                myattachment = new System.Net.Mail.Attachment(attachments_mail);
                //myattachment = new System.Net.Mail.Attachment(Attachmentfile);
                message.Attachments.Add(myattachment);
            }

            client.UseDefaultCredentials = true;

            try
            {
                client.Send(message);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException.InnerException.Message);
            }
            // Clean up.
            message.Dispose();

            bSent = true;
        }
예제 #38
0
        public static string SendEmail(string emailmain, string emailContent, string userid, int hasHref = 0, string href = "")
        {
            try
            {
                string smtpServer   = ConfigurationManager.AppSettings["smtpServer"];
                string mailFrom     = ConfigurationManager.AppSettings["EmailAccount"];
                string userPassword = ConfigurationManager.AppSettings["EmailPassword"];

                SmtpClient smtpClient = new SmtpClient();
                smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; //指定电子邮件发送方式
                smtpClient.Host           = smtpServer;                 //指定SMTP服务器
                smtpClient.Credentials    = new System.Net.NetworkCredential(mailFrom, userPassword);

                //smtpClient.EnableSsl = true;
                smtpClient.Port = 25;
                //string imagesrc = "";
                string Toemail = "";
                User   user    = UserDao.GetUserById(userid);
                Toemail = user.email;
                if (Toemail == "")
                {
                    return("fail");
                }
                string username = user.name;
                string imagesrc = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaEAAABSCAIAAAByu/yWAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGwWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB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yPAb+YY0MdVoQXZQJLm0HCbtoT5nj5tuXOK+f8Q49kNzEx+SxyQRqn8OGR6NZDEYaXV8+lrpyrT8qdEHhR3t3BftBCBxlpRTV12zIbiZtFDCYmJumZAI1T2NEW3docCdHS1EJi5Rxq6QyDJiLjoKOf//h4tLkraiXQujnUxiWUqW4mJiaZM2Eap9A5wG9rYdp7WQRBSgrwRdMt88vJ0gIMzTjmKclwNiB29PPNXWz/sBBmpEm52LUL7atmmztTExOTrJlgjVMQJDjaw398nDk1yEV52UIgdgtalI/n29ECJ5ZvR+1WFENBlgEQYFjJF5ICtOQPib1enuZkQQQnhUzJwxfPsC6sIHJtZlKIiYnJOLkoGqdlcFjs94sd/VyfTwxHxSgvRzmZwBAUBUAABeAEGcMQEkOcFFqYgy2oIKe6cV3DSxMTE5PxcdE1zsTExOSfyP8HGCvku/J3iO0AAAAASUVORK5CYII=";
                //Toemail = "*****@*****.**";
                //string username = "******";
                string EmailMain = emailmain;
                string EmailText = "<table align='center' border='0' cellpadding='0' cellspacing='0'style=' width:88%; margin-top:20px; margin-bottom:20px; background:#fafafa; border:1px solid #ddd;'><tbody>"
                                   + "<tr>"
                                   + "<td width='24'>&nbsp;</td>"
                                   + "<td style='padding-top:16px;'><img height='50px' src='" + imagesrc + "' style='display:block; vertical-align:top;' width='250px'></td>"
                                   + "</tr><tr>"
                                   + "<td width='24'>&nbsp;</td>"
                                   + "<td colspan='2' style='color:#858585; font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; padding-top:24px;'>" + username + " 您好:</td>"
                                   + "<td width='24'>&nbsp;</td>"
                                   + "</tr><tr>"
                                   + "<td width='24'>&nbsp;</td>"
                                   + "<td colspan='2' style='color:#858585; font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; padding-top:18px;'>" + emailContent + "</td>"
                                   + "<td width='24'>&nbsp;</td>"
                                   + "</tr>"
                                   + (hasHref == 1 ? "<tr>" : "")
                                   + (hasHref == 1 ? "<td width='24'>&nbsp;</td>" : "")
                                   + (hasHref == 1 ? "<td colspan='2' style='color:#858585; font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; padding-top:18px;'><a href='" + href + "' style='color:#50b7f1;text-decoration:none;font-weight:bold' target='_blank'>" + emailmain + "</a></td>" : "")
                                   + (hasHref == 1 ? "<td width='24'>&nbsp;</td>" : "")
                                   + (hasHref == 1 ? "</tr>" : "")
                                   + (hasHref == 1 ? "<tr>" : "")
                                   + (hasHref == 1 ? "<td width='24'>&nbsp;</td>" : "")
                                   + (hasHref == 1 ? "<td colspan='2' style='color:#858585; font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; padding-top:24px;'>如果上述链接无法点击,请复制以下链接" + href + " </td>" : "")
                                   + (hasHref == 1 ? "<td width='24'>&nbsp;</td>" : "")
                                   + (hasHref == 1 ? "</tr>" : "")
                                   + "<tr>"
                                   + "<td style='padding-top:18px; padding-bottom:32px; border-bottom:1px solid #e1e1e1;' width='24'>&nbsp;</td>"
                                   + "<td colspan='2' style='color:#858585; font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; padding-top:18px; padding-bottom:32px; border-bottom:1px solid #e1e1e1;'>谢谢使用!<br> 北航软院云平台</td>"
                                   + "<td style='padding-top:18px; padding-bottom:32px; border-bottom:1px solid #e1e1e1;' width='24'>&nbsp;</td>"
                                   + "</tr>"
                                   + "<tr>"
                                   + "<td width='24'>&nbsp;</td>"
                                   + "<td colspan='2' style='color:#858585; font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; padding-top:18px;'>您可以<a href='" + ConfigurationManager.AppSettings["MyServer"] + "' style='color:#50b7f1;text-decoration:none;font-weight:bold' target='_blank'>点击此处访问云平台</a></td>"
                                   + "<td width='24'>&nbsp;</td>"
                                   + "</tr>"
                                   + "<tr>"
                                   + "<td width='24'>&nbsp;</td>"
                                   + "<td colspan='2' style='color:#858585; font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; padding-top:24px;'>如果上述链接无法点击,请复制以下链接到浏览器地址栏进行访问:" + ConfigurationManager.AppSettings["MyServer"] + " </td>"
                                   + "<td width='24'>&nbsp;</td>"
                                   + "</tr>"
                                   + "</tr>"
                                   + "</tbody></table>";
                MailMessage mailMessage = new MailMessage(mailFrom, Toemail);
                mailMessage.Subject      = EmailMain;
                mailMessage.Body         = EmailText;
                mailMessage.BodyEncoding = Encoding.UTF8;
                mailMessage.IsBodyHtml   = true;
                mailMessage.Priority     = MailPriority.Low;
                smtpClient.Send(mailMessage);
                return("success");
            }
            catch (SmtpException ex)
            {
                return(ex.Message);
            }
        }
예제 #39
0
        public IHttpActionResult Feedback()
        {
            string name    = HttpContext.Current.Request.Params["name"];
            string email   = HttpContext.Current.Request.Params["email"];
            string phone   = HttpContext.Current.Request.Params["phone"];
            string subject = HttpContext.Current.Request.Params["subject"];
            string content = HttpContext.Current.Request.Params["content"];

            if (string.IsNullOrWhiteSpace(name))
            {
                return(BadRequest("Please provide your name"));
            }

            if (string.IsNullOrWhiteSpace(email))
            {
                return(BadRequest("Please provide your email address"));
            }

            if (string.IsNullOrWhiteSpace(phone))
            {
                return(BadRequest("Please provide your phone number"));
            }

            if (string.IsNullOrWhiteSpace(subject))
            {
                return(BadRequest("Please provide subject for your feedback"));
            }

            if (string.IsNullOrWhiteSpace(content))
            {
                return(BadRequest("Please provide detail for your feedback"));
            }

            HttpPostedFile postedFile = null;

            if (HttpContext.Current.Request.Files.Count > 0)
            {
                postedFile = HttpContext.Current.Request.Files[0];
            }

            using (SmtpClient sClient = new SmtpClient())
            {
                using (MailMessage mailMessage = new MailMessage())
                {
                    StringBuilder builder = new StringBuilder();
                    builder.AppendLine("New Contact Us request has been submitted details as follows.<br/><br/>");

                    builder.AppendLine($"Name: {name}<br/>");
                    builder.AppendLine($"Email: {email}<br/>");
                    builder.AppendLine($"Phone: {phone}<br/><br/>");

                    builder.AppendLine($"Detail: {content}<br/>");

                    foreach (var address in Settings.Default.SupportEmails.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        mailMessage.To.Add(address);
                    }

                    mailMessage.From       = new MailAddress("*****@*****.**");
                    mailMessage.Body       = builder.ToString();
                    mailMessage.IsBodyHtml = true;
                    mailMessage.Subject    = $"Brahmkshatriya - {subject}";

                    if (postedFile != null)
                    {
                        Attachment attachment = new Attachment(postedFile.InputStream, postedFile.FileName, postedFile.ContentType);
                        mailMessage.Attachments.Add(attachment);
                    }

                    sClient.Send(mailMessage);
                }
            }

            return(Ok());
        }
예제 #40
0
        /// <summary>
        /// 发送邮件,所有参数
        /// </summary>
        /// <param name="subject">标题</param>
        /// <param name="body">内容</param>
        /// <param name="priority">邮件优先级</param>
        /// <param name="isHtml">是否Html</param>
        /// <param name="mailTo">收件人列表</param>
        /// <param name="mailBCC">密送人列表</param>
        /// <param name="attetchments">附件地址列表</param>
        /// <returns></returns>
        public static bool SendMail(string subject, string body, MailPriority priority, bool isHtml, string mailTo, string mailBCC, string[] attetchments)
        {
            SmtpClient client = new SmtpClient(smtp)
            {
                UseDefaultCredentials = false,
                Credentials           = new NetworkCredential(senderUserMail, senderPassword),
                DeliveryMethod        = SmtpDeliveryMethod.Network
            };
            MailMessage message = new MailMessage();

            message.Sender = new MailAddress(senderUserMail, senderUserName);
            message.From   = new MailAddress(senderUserMail, senderUserName);

            message.IsBodyHtml   = isHtml;
            message.Priority     = priority;
            message.BodyEncoding = Encoding.UTF8;

            // 收件人列表
            mailTo = mailTo ?? string.Empty;
            string[] mails = mailTo.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            if (mails.Length == 0)
            {
                return(false);
            }
            foreach (string item in mails)
            {
                try
                {
                    message.To.Add(new MailAddress(item, item));
                }
                catch (Exception ex)
                {
                    NLogUtility.ExceptionLog(ex, "SendMail", "MailHelper", string.Format("TO:{0}", item));
                }
            }

            // 密送人列表
            mailBCC = mailBCC ?? string.Empty;
            string[] ccmails = mailBCC.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string item in ccmails)
            {
                try
                {
                    message.Bcc.Add(new MailAddress(item, item));
                }
                catch (Exception ex)
                {
                    NLogUtility.ExceptionLog(ex, "SendMail", "MailHelper", string.Format("BCC:{0}", item));
                }
            }

            message.Subject = subject;
            message.Body    = body;

            //添加附件
            if (attetchments != null)
            {
                foreach (string file in attetchments)
                {
                    if (File.Exists(file))
                    {
                        message.Attachments.Add(new Attachment(file));
                    }
                }
            }

            try
            {
                client.Send(message);
            }
            catch (Exception ex)
            {
                NLogUtility.ExceptionLog(ex, "SendMail", "MailHelper", string.Format("邮件内容:{1}{0}{2}", Environment.NewLine, subject, body));
                return(false);
            }

            return(true);
        }
예제 #41
0
        public void r100Implementation(MemberServiceBillDueModel instance)
        {
            // This is the placeholder for method implementation.

            if ((instance.MemberID > 0))
            {
                string      fileName;
                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient("smtp.gmail.com");
                mail.From = new MailAddress("*****@*****.**");
                mail.To.Add(instance.Email);
                mail.Subject = "Member Due Bill";
                mail.Body    = "check mail with attachment";

                LocalReport report = new LocalReport();
                report.ReportPath = HttpContext.Current.Server.MapPath("/Controls/") + "MemberDueStatement.rdlc";
                ReportDataSource rds = new ReportDataSource();
                rds.Name  = "DataSet1";//This refers to the dataset name in the RDLC file
                rds.Value = GetDailyDueStatement(instance.MemberID.Value);
                report.DataSources.Add(rds);
                //Byte[] mybytes = report.Render("WORD");
                Byte[] mybytes = report.Render("PDF"); //for exporting to PDF
                //string PDFPath = @"PDF\MemberDueFile_" + instance.MemberID.Value.ToString() + ".doc";

                string PDFPath = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/")) + "PDF\\";
                fileName = "MemberDueFile_" + instance.MemberID.Value.ToString() + ".pdf";
                Microsoft.Reporting.WebForms.Warning[] warnings = null;

                string[] streamids = null;
                String   mimeType  = null;
                String   encoding  = null;
                String   extension = null;
                Byte[]   bytes     = null;

                // bytes = LocalReport.Render("PDF", "", out mimeType, out encoding, out extension, out streamids, out warnings);
                bool IsExitsPDF = File.Exists(PDFPath + fileName);

                FileStream fs   = new FileStream(PDFPath + fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite);
                byte[]     data = new byte[fs.Length];
                fs.Write(mybytes, 0, mybytes.Length);
                fs.Close();
                //PdfLocation = PDFPath + fileName;

                /*
                 * using (FileStream fs1 = File.Create(@fileName))
                 * {
                 *  fs1.Write(mybytes, 0, mybytes.Length);
                 *  byte[] data1 = new byte[fs1.Length];
                 *  fs1.Write(mybytes, 0, mybytes.Length);
                 *  fs1.Close();
                 * }
                 */
                IsExitsPDF = File.Exists(PDFPath + fileName);

                ///FileStream fs1 = new FileStream(PDFPath + fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite);
                ///PdfLocation = PDFPath + fileName;
                if (IsExitsPDF)
                {
                    System.Net.Mail.Attachment attachment;
                    attachment = new System.Net.Mail.Attachment(PDFPath + fileName);
                    mail.Attachments.Add(attachment);
                }


                SmtpServer.Port        = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "kabir31bd@!#");
                SmtpServer.EnableSsl   = true;
                try
                {
                    SmtpServer.Send(mail);
                    Result.ShowAlert("Successfully Send Mail to Member");
                    this.PreventDefault();
                }
                catch
                {
                }
            }
        }
예제 #42
0
        public void WhenPathIsNullThenShouldThrowException()
        {
            MailMessage message = new MailMessage();

            Assert.ThrowsException <ArgumentNullException>(() => MailUtil.SaveEml(message, null));
        }
예제 #43
0
        /// <summary>
        /// Schedules the error to be e-mailed synchronously.
        /// </summary>

        protected virtual void ReportError(Error error)
        {
            if (error == null)
            {
                throw new ArgumentNullException("error");
            }

            //
            // Start by checking if we have a sender and a recipient.
            // These values may be null if someone overrides the
            // implementation of OnInit but does not override the
            // MailSender and MailRecipient properties.
            //

            string sender        = Mask.NullString(this.MailSender);
            string recipient     = Mask.NullString(this.MailRecipient);
            string copyRecipient = Mask.NullString(this.MailCopyRecipient);

#if NET_1_0 || NET_1_1
            //
            // The sender can be defaulted in the <system.net> settings in 2.0
            //

            if (sender.Length == 0)
            {
                return;
            }
#endif

            if (recipient.Length == 0)
            {
                return;
            }

            //
            // Create the mail, setting up the sender and recipient and priority.
            //

            MailMessage mail = new MailMessage();
            mail.Priority = this.MailPriority;

#if NET_1_0 || NET_1_1
            mail.From = sender;
            mail.To   = recipient;

            if (copyRecipient.Length > 0)
            {
                mail.Cc = copyRecipient;
            }
#else
            mail.From = new MailAddress(sender);
            mail.To.Add(recipient);

            if (copyRecipient.Length > 0)
            {
                mail.CC.Add(copyRecipient);
            }
#endif
            //
            // Format the mail subject.
            //

            string subjectFormat = Mask.EmptyString(this.MailSubjectFormat, "Error ({1}): {0}");
            mail.Subject = string.Format(subjectFormat, error.Message, error.Type).
                           Replace('\r', ' ').Replace('\n', ' ');

            //
            // Format the mail body.
            //

            ErrorTextFormatter formatter = CreateErrorFormatter();

            StringWriter bodyWriter = new StringWriter();
            formatter.Format(bodyWriter, error);
            mail.Body = bodyWriter.ToString();

            switch (formatter.MimeType)
            {
#if NET_1_0 || NET_1_1
            case "text/html": mail.BodyFormat = MailFormat.Html; break;

            case "text/plain": mail.BodyFormat = MailFormat.Text; break;
#else
            case "text/html": mail.IsBodyHtml = true; break;

            case "text/plain": mail.IsBodyHtml = false; break;
#endif
            default:
            {
                throw new ApplicationException(string.Format(
                                                   "The error mail module does not know how to handle the {1} media type that is created by the {0} formatter.",
                                                   formatter.GetType().FullName, formatter.MimeType));
            }
            }

#if NET_1_1
            //
            // If the mail needs to be delivered to a particular SMTP server
            // then set-up the corresponding CDO configuration fields of the
            // mail message.
            //

            string smtpServer = Mask.NullString(this.SmtpServer);

            if (smtpServer.Length > 0)
            {
                IDictionary fields = mail.Fields;

                fields.Add(CdoConfigurationFields.SendUsing, /* cdoSendUsingPort */ 2);
                fields.Add(CdoConfigurationFields.SmtpServer, smtpServer);
                int smtpPort = this.SmtpPort;
                fields.Add(CdoConfigurationFields.SmtpServerPort, smtpPort <= 0 ? 25 : smtpPort);

                //
                // If the SMTP server requires authentication (indicated by
                // non-blank user name and password settings) then set-up
                // the corresponding CDO configuration fields of the mail
                // message.
                //

                string userName = Mask.NullString(this.AuthUserName);
                string password = Mask.NullString(this.AuthPassword);

                if (userName.Length > 0 && password.Length > 0)
                {
                    fields.Add(CdoConfigurationFields.SmtpAuthenticate, 1);
                    fields.Add(CdoConfigurationFields.SendUserName, userName);
                    fields.Add(CdoConfigurationFields.SendPassword, password);
                }
            }
#endif
            MailAttachment     ysodAttachment = null;
            ErrorMailEventArgs args           = new ErrorMailEventArgs(error, mail);

            try
            {
                //
                // If an HTML message was supplied by the web host then attach
                // it to the mail if not explicitly told not to do so.
                //

                if (!NoYsod && error.WebHostHtmlMessage.Length > 0)
                {
                    ysodAttachment = CreateHtmlAttachment("YSOD", error.WebHostHtmlMessage);

                    if (ysodAttachment != null)
                    {
                        mail.Attachments.Add(ysodAttachment);
                    }
                }

                //
                // Send off the mail with some chance to pre- or post-process
                // using event.
                //

                OnMailing(args);
                SendMail(mail);
                OnMailed(args);
            }
            finally
            {
#if NET_1_0 || NET_1_1
                //
                // Delete any attached files, if necessary.
                //

                if (ysodAttachment != null)
                {
                    File.Delete(ysodAttachment.Filename);
                    mail.Attachments.Remove(ysodAttachment);
                }
#endif
                OnDisposingMail(args);

#if !NET_1_0 && !NET_1_1
                mail.Dispose();
#endif
            }
        }
예제 #44
0
        private bool EnviarCorreo(int idrequerimiento)
        {
            try
            {
                StringBuilder cadenaHMLT = new StringBuilder();
                using (ConnectionRicardoPalma bdRicardo = new ConnectionRicardoPalma())
                {
                    var req = bdRicardo.RequerimientoInsumo.Where(g => g.IdRequerimientoInsumo == idrequerimiento).Select(h => new
                    {
                        h.IdRequerimientoInsumo,
                        h.FechaSolicitud,
                        Solicitante = h.PersonalEmergencia.Nombres + " " + h.PersonalEmergencia.ApellidoPaterno + " " + h.PersonalEmergencia.ApellidoMaterno
                    }).First();


                    var insumo = bdRicardo.Requerimiento_Insumo.Where(j => j.IdRequerimientoInsumo == idrequerimiento).Select(g => new
                    {
                        IdInsumo     = g.IdInsumo,
                        NombreInsumo = g.Insumo.NombreInsumo,
                        Cantidad     = g.Cantidad,
                        Motivo       = g.Motivo
                    }).ToList();


                    cadenaHMLT.AppendLine("<html> <div  style='width:600px' >" +
                                          "<span style='font-weight:bold;font-size:17px'>Notificación: Requerimiento de Insumos de Emergencia</span>" +
                                          "<table width='100%' cellspacing='8' cellpadding='0' border='0' align='center'>" +

                                          "<tr style='border-bottom-color:black;border-width:1px;border-style:solid'>" +
                                          "<td style='font-weight:bold' >N° de Requerimiento:</td>" +
                                          "<td >" + req.IdRequerimientoInsumo.ToString() + "</td>	"+
                                          "</tr>" +

                                          "<tr style='border-bottom-color:black;border-width:1px;border-style:solid'>	"+
                                          "<td style='font-weight:bold'>Solicitante: </td>" +
                                          "<td >" + req.Solicitante +
                                          "</tr>" +

                                          "<tr style='border-bottom-color:black;border-width:1px;border-style:solid'>	"+
                                          "<td style='font-weight:bold'>Fecha Solicitud: </td>" +
                                          "<td >" + req.FechaSolicitud.ToString("dd/MM/yyyy") + "</td>" +
                                          "</tr>" +
                                          "<tr><td colspan='2'><hr/><td></tr>" +
                                          "<tr style='border-bottom-color:black;border-width:1px;border-style:solid'>" +
                                          "<td colspan='2' >" +
                                          "<center><span style='font-weight:bold;font-size:14px'>Insumos</span></center></br>" +
                                          "<table align='center'>" +
                                          "<tr style='border-bottom-color:black;border-width:0.5px;border-style:solid'>" +
                                          "<td style='font-weight:bold'>Insumo</td>" +
                                          "<td style='font-weight:bold'>Cantidad</td>" +
                                          "<td style='font-weight:bold'>Motivo</td>" +
                                          "</tr>");
                    foreach (var item in insumo)
                    {
                        cadenaHMLT.AppendLine("<tr>");
                        cadenaHMLT.AppendLine("<td style='border: 1px solid black;'>" + item.NombreInsumo + "</td>");
                        cadenaHMLT.AppendLine("<td style='border: 1px solid black;'>" + item.Cantidad + "</td>");
                        cadenaHMLT.AppendLine("<td style='border: 1px solid black;'>" + item.Motivo + "</td>");
                        cadenaHMLT.AppendLine("</tr>");
                    }

                    cadenaHMLT.AppendLine("</table>" +
                                          "</td>	"+
                                          "</tr>" +

                                          "<tr>	" +
                                          "<td colspan='2'><a href='" + ConfigurationManager.AppSettings["strUrl"] + "RequerimientoInsumo/AprobarPorCorreo/" + req.IdRequerimientoInsumo.ToString() + "' target='_blank'>Autorizar Requerimiento</a></td>	"+
                                          "</tr>" +

                                          "</table>" +
                                          "</div></html>");
                }



                var          fromAddress  = new MailAddress(ConfigurationManager.AppSettings["strCorreoRemitente"], ConfigurationManager.AppSettings["strNombreRemitente"]);
                var          toAddress    = new MailAddress(ConfigurationManager.AppSettings["strCorreoDestinatario"], ConfigurationManager.AppSettings["strNombreDestinatario"]);
                string       fromPassword = ConfigurationManager.AppSettings["strPassword"];
                const string subject      = "Requerimiento Insumo Emergencia";
                string       body         = cadenaHMLT.ToString();

                var smtp = new SmtpClient
                {
                    Host           = "smtp.gmail.com",
                    Port           = 587,
                    EnableSsl      = true,
                    DeliveryMethod = SmtpDeliveryMethod.Network,
                    Credentials    = new NetworkCredential(fromAddress.Address, fromPassword),
                    Timeout        = 20000
                };
                using (var message = new MailMessage(fromAddress, toAddress)
                {
                    Subject = subject,
                    Body = body,
                    IsBodyHtml = true
                })
                {
                    smtp.Send(message);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
            return(true);
        }
예제 #45
0
        public bool SendNewsLetter(NewsLetterModel model)
        {
            bool Status = false;
            // string EmailId = "*****@*****.**";
            var FirstImage  = "";
            var SecondImage = "";
            var Images      = model.PropertyPhoto.Split(',');

            if (Images.Count() > 0)
            {
                FirstImage = Images[0];
                if (Images.Count() > 1)
                {
                    SecondImage = Images[1];
                }
            }
            else
            {
                FirstImage = model.PropertyPhoto;
            }
            string msgbody  = "";
            var    Template = "";

            Template = "Templates/Double_Image_NewsLetter.html";

            using (StreamReader reader = new StreamReader(Path.Combine(HttpRuntime.AppDomainAppPath, Template)))
            {
                msgbody = reader.ReadToEnd();
                //Replace UserName and Other variables available in body Stream
                msgbody = msgbody.Replace("{firstimage}", FirstImage);
                msgbody = msgbody.Replace("{secondimage}", SecondImage);
            }

            try
            {
                //Send mail
                MailMessage mail = new MailMessage();

                string FromEmailID       = WebConfigurationManager.AppSettings["RegFromMailAddress"];
                string FromEmailPassword = WebConfigurationManager.AppSettings["RegPassword"];

                SmtpClient smtpClient             = new SmtpClient(ConfigurationManager.AppSettings["SmtpServer"]);
                int        _Port                  = Convert.ToInt32(WebConfigurationManager.AppSettings["Port"].ToString());
                Boolean    _UseDefaultCredentials = Convert.ToBoolean(WebConfigurationManager.AppSettings["UseDefaultCredentials"].ToString());
                Boolean    _EnableSsl             = Convert.ToBoolean(WebConfigurationManager.AppSettings["EnableSsl"].ToString());
                mail.To.Add(new MailAddress(model.Email));
                mail.From            = new MailAddress(FromEmailID);
                mail.Subject         = "News Letter";
                mail.BodyEncoding    = System.Text.Encoding.UTF8;
                mail.SubjectEncoding = System.Text.Encoding.UTF8;
                System.Net.Mail.AlternateView plainView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(System.Text.RegularExpressions.Regex.Replace(msgbody, @"<(.|\n)*?>", string.Empty), null, "text/plain");
                System.Net.Mail.AlternateView htmlView  = System.Net.Mail.AlternateView.CreateAlternateViewFromString(msgbody, null, "text/html");

                mail.AlternateViews.Add(plainView);
                mail.AlternateViews.Add(htmlView);
                // mail.Body = msgbody;
                mail.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                smtp.Host           = "smtp.gmail.com"; //_Host;
                smtp.Port           = _Port;
                //smtp.UseDefaultCredentials = _UseDefaultCredentials;
                smtp.Credentials = new System.Net.NetworkCredential(FromEmailID, FromEmailPassword);// Enter senders User name and password
                smtp.EnableSsl   = _EnableSsl;
                smtp.Send(mail);

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
예제 #46
0
        private bool basicEnviar(String toEmail, String toName, string sCcAddress, string sCcAddressName, string sBccAddress, string subject, string body, IList <string> attachments, IDictionary <string, System.IO.Stream> attachments2, IDictionary <string, string> embeddedAttachments, bool sendBccCopy)
        {
            try
            {
                var toAddress = new MailAddress(toEmail, toName);
                var smtp      = new SmtpClient();
                var message   = new MailMessage()
                {
                    Subject = subject,
                    Body    = body
                };

                message.To.Add(toAddress);
                if (custom)
                {
                    smtp.Host                  = mailHost;
                    smtp.Port                  = mailPort;
                    smtp.EnableSsl             = mailSSL;
                    smtp.DeliveryMethod        = SmtpDeliveryMethod.Network;
                    smtp.UseDefaultCredentials = false;
                    smtp.Credentials           = new NetworkCredential(fromAddress.Address, fromPassword);
                    message.From               = fromAddress;
                }
                ;

                if (sCcAddress != null)
                {
                    message.CC.Add(new MailAddress(sCcAddress));
                }

                if (sBccAddress != null)
                {
                    message.Bcc.Add(new MailAddress(sBccAddress));
                }

                if (sendBccCopy)
                {
                    try
                    {
                        System.Configuration.Configuration configurationFile = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/web.config");
                        var mailSettings = configurationFile.GetSectionGroup("system.net/mailSettings") as System.Net.Configuration.MailSettingsSectionGroup;
                        if (mailSettings != null)
                        {
                            string usernameSettings = mailSettings.Smtp.From;
                            message.Bcc.Add(new MailAddress(usernameSettings));
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex);
                    }
                }

                message.IsBodyHtml = true;

                if (attachments != null && attachments.Count > 0)
                {
                    foreach (string s in attachments)
                    {
                        message.Attachments.Add(new Attachment(s));
                    }
                }
                if (attachments2 != null && attachments2.Count > 0)
                {
                    foreach (string s in attachments2.Keys)
                    {
                        message.Attachments.Add(new Attachment(attachments2[s], s));
                    }
                }
                if (embeddedAttachments != null && embeddedAttachments.Count > 0)
                {
                    AlternateView htmlView = AlternateView.CreateAlternateViewFromString(body, null, System.Net.Mime.MediaTypeNames.Text.Html);
                    foreach (string s in embeddedAttachments.Keys)
                    {
                        LinkedResource imagelink = new LinkedResource(embeddedAttachments[s], getMediaType(embeddedAttachments[s]));
                        imagelink.ContentId        = s;
                        imagelink.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;
                        htmlView.LinkedResources.Add(imagelink);
                    }
                    message.AlternateViews.Add(htmlView);
                }

                ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); };
                smtp.Send(message);
                return(true);
            }

            catch (Exception ex)
            {
                logger.Error(ex);
                return(false);
            }
        }
    protected void SendEmails()
    {
        try
        {
            SmtpClient  smtp = new SmtpClient("localhost");
            MailMessage mm;
            DataLayer   dl                = new DataLayer();
            DataTable   dt                = dl.GetAllMotivatorSubscribedMembers();
            DataTable   dt2               = dl.GetAllMotivatorSubscribedNonMembers();
            DataTable   dtMotivator       = dl.GetLastUnSentDailyMotivator();
            int         iDailyMotivatorID = Convert.ToInt32(dtMotivator.Rows[0].ItemArray[0]);
            dl.MarkDailyMotivatorSent(iDailyMotivatorID);
            dl.UpdateLastMotivatorDate(DateTime.Now);

            ArrayList alFail = new ArrayList();
            foreach (DataRow dr in dt.Rows)
            {
                try
                {
                    mm            = new MailMessage();
                    mm.IsBodyHtml = true;
                    mm.To.Add(dr.ItemArray[1].ToString());
                    mm.From    = new MailAddress("*****@*****.**");
                    mm.Subject = dtMotivator.Rows[0].ItemArray[3].ToString();
                    mm.Body    = "<div style=\"width: 790px; background-color: #333333; padding: 5px; border: solid 1px #333333;\"><a href=\"http://www.ReferralNetworX.com\"><img style=\"height: 125px; border-width:0px;\" src=\"http://www.referralnetworx.com/MakeThumbnail.aspx?size=237&image=images/networking.jpg\" /><img style=\"border-width:0px;\" src=\"http://www.referralnetworx.com/images/banner.jpg\" /></a></div>";
                    mm.Body   += "<div style=\"width: 770px; background-color: #ddeedd; padding: 15px; border: solid 1px #333333;\"><div style=\"font-size:35px;text-align:center;margin-bottom:10px;\">Daily Motivator</div>";
                    string sName = dl.GetMemberNameBy_Email(dr.ItemArray[1].ToString());
                    mm.Body += "Hello " + sName + ",<br /><br />";
                    string sYouTubeLink = dtMotivator.Rows[0].ItemArray[5].ToString();
                    if (sYouTubeLink != "No Video.")
                    {
                        mm.Body += "<h1 style=\"text-align:center;\"><a href=\"" + sYouTubeLink + "\">Click Here to Watch The Video Motivator</a></h1>";
                    }
                    mm.Body += dtMotivator.Rows[0].ItemArray[4].ToString();
                    mm.Body += "<h2 style=\"text-align:center;\"><a href=\"http://www.ReferralNetworX.com\">Visit ReferralNetworX.com!</a></h2>";
                    mm.Body += "</div>";
                    int  iCount = 0;
                    bool bLoop  = true;
                    while (bLoop)
                    {
                        try
                        {
                            smtp.Send(mm);
                            bLoop = false;
                        }
                        catch (Exception ex)
                        {
                            System.Threading.Thread.Sleep(1000);
                            iCount++;
                            if (iCount >= 3)
                            {
                                alFail.Add(dr.ItemArray[0].ToString() + " - FAILED ON SEND");
                                alFail.Add(ex.ToString());
                                bLoop = false;
                            }
                        }
                    }
                }
                catch (Exception ex2)
                {
                    alFail.Add(dr.ItemArray[0].ToString() + " - FAILED BEFORE SEND");
                    alFail.Add(ex2.ToString());
                }
            }
            foreach (DataRow dr in dt2.Rows)
            {
                try
                {
                    mm            = new MailMessage();
                    mm.IsBodyHtml = true;
                    mm.To.Add(dr.ItemArray[1].ToString());
                    mm.From    = new MailAddress("*****@*****.**");
                    mm.Subject = dtMotivator.Rows[0].ItemArray[3].ToString();
                    mm.Body    = "<div style=\"width: 790px; background-color: #333333; padding: 5px; border: solid 1px #333333;\"><a href=\"http://www.ReferralNetworX.com\"><img style=\"height: 125px;border-width:0px;\" src=\"http://www.referralnetworx.com/MakeThumbnail.aspx?size=237&image=images/networking.png\" /><img style=\"border-width:0px;\" src=\"http://www.referralnetworx.com/images/banner.png\" /></a></div>";
                    mm.Body   += "<div style=\"width: 770px; background-color: #ddeedd; padding: 15px; border: solid 1px #333333;\"><div style=\"font-size:35px;text-align:center;margin-bottom:10px;\">Daily Motivator</div>";
                    string sName = dl.GetNonMemberNameBy_Email(dr.ItemArray[1].ToString());
                    mm.Body += "Hello " + sName + ",<br /><br />";
                    string sYouTubeLink = dtMotivator.Rows[0].ItemArray[5].ToString();
                    if (sYouTubeLink != "No Video.")
                    {
                        mm.Body += "<h1 style=\"text-align:center;\"><a href=\"" + sYouTubeLink + "\">Click Here to Watch The Video Motivator</a></h1>";
                    }
                    mm.Body += dtMotivator.Rows[0].ItemArray[4].ToString();
                    mm.Body += "<h2 style=\"text-align:center;\"><a href=\"http://www.ReferralNetworX.com\">Visit ReferralNetworX.com!</a></h2>";
                    mm.Body += "</div>";
                    mm.Body += "<div style=\"font-size: 12px; border: solid 1px #333333; background-color: #ddeedd; padding: 5px; width: 790px;\">Click <a href=\"http://www.referralnetworx.com/Subscribe.aspx?e=" + dr.ItemArray[1].ToString() + "&type=dailymotivator\">here</a> to unsubscribe.</div>";
                    int  iCount = 0;
                    bool bLoop  = true;
                    while (bLoop)
                    {
                        try
                        {
                            smtp.Send(mm);
                            bLoop = false;
                        }
                        catch (Exception ex)
                        {
                            System.Threading.Thread.Sleep(1000);
                            iCount++;
                            if (iCount >= 3)
                            {
                                alFail.Add(dr.ItemArray[0].ToString() + " - FAILED ON SEND");
                                alFail.Add(ex.ToString());
                                bLoop = false;
                            }
                        }
                    }
                }
                catch (Exception ex2)
                {
                    alFail.Add(dr.ItemArray[0].ToString() + " - FAILED BEFORE SEND");
                    alFail.Add(ex2.ToString());
                }
            }

            mm            = new MailMessage();
            mm.IsBodyHtml = true;
            mm.To.Add("*****@*****.**");
            mm.From    = new MailAddress("*****@*****.**");
            mm.Subject = "RNX Daily Motivator Failure Report";
            mm.Body    = "Number of failures: " + Convert.ToString(alFail.Count / 2) + "<br /><br />";
            foreach (string sFail in alFail)
            {
                mm.Body += sFail + "<br /><br />";
            }
            int  iCount2 = 0;
            bool bLoop2  = true;
            while (bLoop2)
            {
                try
                {
                    smtp.Send(mm);
                    bLoop2 = false;
                }
                catch
                {
                    iCount2++;
                    if (iCount2 >= 25)
                    {
                        bLoop2 = false;
                    }
                }
            }
        }
        catch (Exception exc)
        {
            MailMessage msg = new MailMessage();
            msg.IsBodyHtml = true;
            msg.To.Add("*****@*****.**");
            msg.From    = new MailAddress("*****@*****.**");
            msg.Subject = "Something went terribly wrong.";
            msg.Body    = exc.ToString();
            SmtpClient smtp = new SmtpClient();
            smtp.Send(msg);
        }
    }
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        Page.Validate();


        string selectedCountry = Request.Form["_helpQueryCountryList"];

        MailMessage _helpMessage = new MailMessage();

        _helpMessage.From = new MailAddress(ConfigurationManager.AppSettings["ContactUsFromAddress"]);

        if (Request.Form["_helpQueryCountryList"] == "USA")
        {
            _helpMessage.To.Add(ConfigurationManager.AppSettings["USAContactUsToAddress"]);
            _helpMessage.Subject = ConfigurationManager.AppSettings["USAContactUsSubject"];
        }
        else
        {
            _helpMessage.To.Add(ConfigurationManager.AppSettings["OtherContactUsToAddress"]);
            _helpMessage.Subject = ConfigurationManager.AppSettings["OtherContactUsSubject"];
        }

        string        _messgebody = BuildMessageBody(Request.Form["_helpQueryCountryList"]);
        SmtpClient    SMTPServer  = new SmtpClient();
        AlternateView PlainText;

        PlainText = AlternateView.CreateAlternateViewFromString(_messgebody, null, "text/plain");
        _helpMessage.AlternateViews.Add(PlainText);
        _helpMessage.BodyEncoding    = Encoding.UTF8;
        _helpMessage.SubjectEncoding = Encoding.UTF8;

        //file upload
        if (_helpQueryFileUploader.HasFile)
        {
            _helpMessage.Attachments.Add(new System.Net.Mail.Attachment(_helpQueryFileUploader.PostedFile.InputStream, _helpQueryFileUploader.FileName));
        }

        if (_helpQueryFileUploader2.HasFile)
        {
            _helpMessage.Attachments.Add(new System.Net.Mail.Attachment(_helpQueryFileUploader2.PostedFile.InputStream, _helpQueryFileUploader2.FileName));
        }


        if (_helpQueryFileUploader3.HasFile)
        {
            _helpMessage.Attachments.Add(new System.Net.Mail.Attachment(_helpQueryFileUploader3.PostedFile.InputStream, _helpQueryFileUploader3.FileName));
        }

        if (_helpQueryFileUploader4.HasFile)
        {
            _helpMessage.Attachments.Add(new System.Net.Mail.Attachment(_helpQueryFileUploader4.PostedFile.InputStream, _helpQueryFileUploader4.FileName));
        }


        if (_helpQueryFileUploader5.HasFile)
        {
            _helpMessage.Attachments.Add(new System.Net.Mail.Attachment(_helpQueryFileUploader5.PostedFile.InputStream, _helpQueryFileUploader5.FileName));
        }

        try
        {
            SMTPServer.Send(_helpMessage);
            Response.Redirect("ThankYou.aspx?sender=contactguestrelations.aspx&message=" + Server.UrlEncode("Guest Relations"));

            _helpMessage.Dispose();
        }
        catch (SmtpException smtpEx)
        {
        }
    }
    protected void Button3_Click2(object sender, EventArgs e)
    {
        try
        {
            string         constring = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString();
            DataWorksClass dw        = new DataWorksClass(constring);
            dw.SetDataAdapter(@"select * from namal where User_ID='" + uid + "' ");
            DataTable dt = dw.GetDataTable();

            cPass = (dt.Rows[0][2].ToString()).Trim(); //current pass
            string newPass     = TextBox17.Text.Trim();
            string newPassConf = TextBox18.Text.Trim();

            if (TextBox16.Text.Trim() == cPass)
            {
                if (newPass == newPassConf)
                {
                    dw.SetCommand(@"UPDATE namal SET Password=@Password where User_ID='" + uid + "' ");
                    dw.SetSqlCommandParameters("@Password", TextBox17.Text.Trim());
                    dw.Update();

                    Label32.Text = "";
                    Label33.Text = "";

                    //Email Start......................................................

                    dw.SetCommand("SELECT E_mail FROM namal WHERE User_ID = @uid");
                    dw.SetSqlCommandParameters("uid", uid);
                    string email = dw.GetSingleData().Trim();
                    string npass = TextBox17.Text.Trim();

                    dw.SetCommand("SELECT First_name FROM Nurse WHERE User_ID = @uid");
                    dw.SetSqlCommandParameters("uid", uid);
                    string fname = dw.GetSingleData().Trim();


                    MailMessage mm = new MailMessage("*****@*****.**", email);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  //(your gmail,receiver gmail)
                    mm.Subject = "KDU CMS | Password Reset!";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           //Subject
                    mm.Body    = "<b>" + "Dear " + fname + "," + "</b> <br>" + "Your password has been changed on KDU Online Channelling and Management System." + "<br> <br>" + "<table>" + "<tr>" + "<td>" + "Your changed Password " + "</td>" + "<td>" + "<b>" + npass + "</b>" + "</td>" + "</tr>" + "</table>" + "<br> <br>" + "<i>" + "Important! Keep your password in a secure place. After remembering your password, permanantly delete this email for your account's safty." + "</i>" + "<br> <br>" + "<table>" + "<tr>" + "<td>" + "<img src=\"https://preview.ibb.co/kaGrEf/logo.png\" width=\"50px\">" + "&nbsp; &nbsp;" + "</td>" + "<td>" + "<b>" + "KDU Channeling Center," + "<br>" + "General Sir John Kotelawala Defence University," + "<br>" + "Southern Campus," + "<br>" + "Sooriyawewa." + "<br>" + "+94718810575" + "</b>" + "</td>" + "</tr>" + "</table>"; //Message

                    //+"<table>"+
                    //    "<tr>"+
                    //        "<td>" + "Your Channel Number " + "</td>" +
                    //        "<td>" + "<b>" + channelno + "</b>" + "</td>" +
                    //    "</tr>"+
                    //    "<tr>" +
                    //        "<td>" + "Your Reserved Date " + "</td>" +
                    //        "<td>" + "<b>" + TextBox3.Text.Trim() + "</b>" + "</td>" +
                    //    "</tr>" +
                    //    "<tr>" +
                    //        "<td>" + "Doctor " + "</td>" +
                    //        "<td>" + "<b>" + TextBox2.Text.Trim() + "</b>" + "</td>" +
                    //    "</tr>" +
                    //    "<tr>" +
                    //        "<td>" + "Specialization " +"</td>" +
                    //        "<td>" + "<b>" + TextBox4.Text.Trim() + "</b>" + "</td>" +
                    //    "</tr>" +
                    //"</table>"+

                    //+"<table>" +
                    //    "<tr>" +
                    //        "<td>" + "<img src=\"https://preview.ibb.co/kaGrEf/logo.png\" width=\"50px\">" + "&nbsp; &nbsp;" + "</td>" +
                    //        "<td>" + "<b>" + "KDU Channeling Center,"+"<br>"+"General Sir John Kotelawala Defence University,"+"<br>"+"Southern Campus,"+"<br>"+"Sooriyawewa."+"<br>"+"+94718810575"+"</b>" + "</td>" +
                    //    "</tr>" +
                    //"</table>" +

                    mm.IsBodyHtml = true;
                    SmtpClient smtp = new SmtpClient();
                    smtp.Host      = "smtp.gmail.com";
                    smtp.EnableSsl = true;
                    NetworkCredential networkcred = new NetworkCredential("*****@*****.**", "KDU123cms");//(your gmail & gmail password)
                    smtp.UseDefaultCredentials = true;
                    smtp.Credentials           = networkcred;
                    smtp.Port = 587;
                    smtp.Send(mm);

                    //Response.Write("<script language=javascript>alert('BOOKING SUCCESSFULL! CHECK YOUR EMAILS!')</script>");
                    Response.Redirect("~/User/Doctor/Account.aspx");

                    //---------------------------------End Email
                }
                else
                {
                    Label33.Text = "";
                    Label32.Text = "Password does not match!";
                }
            }
            else
            {
                Label33.Text = "Incorrect Password!";
                Label32.Text = "";
            }
        }
        catch { }
    }
예제 #50
0
파일: SendMail.cs 프로젝트: hst-bridge/BBS
        /// <summary>
        /// 发送eamil
        /// </summary>
        /// <param name="strAllInfo">mail body</param>
        /// <param name="mailattachments">file name</param>
        /// <param name="toFlag">0: send to receiver set in &lt;appSettings&gt;; other: send to me.</param>
        public void SendEmail(string strAllInfo, string mailattachments = null, int toFlag = 0)
        {
            SmtpClient  client = new SmtpClient();
            MailMessage msg    = new MailMessage();

            client.UseDefaultCredentials = true;

            DataSet ds = new DataSet();

            System.Text.Encoding encoding = System.Text.Encoding.UTF8;

            AppConfig ac = new AppConfig();

            try
            {
                logger.Info("Begin to get the head info of mail...");
                string username = ac.getEmailUser();
                string cc       = ac.getEmailDataSendCC();
                string password = ac.getEmailPwd();
                string smtp     = ac.getSMTP();
                string to       = ac.getEmailDataSendTo();
                string subject  = ac.getMailDataSubject();
                logger.Info("Success to get the head info of mail.");

                logger.Info("Begin to get or set the SMTP info...");
                client.Credentials    = new NetworkCredential(username, password);
                client.DeliveryMethod = SmtpDeliveryMethod.Network;
                client.Host           = smtp;//smtp
                client.Port           = 25;

                client.Timeout = 20000;
                logger.Info("Success to get or set the SMTP info.");

                string[] toArr   = to.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                string[] toArrCC = cc.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                //根据toFlag,判断是否群发
                logger.Info("Begin to load the infos of receivers and cc...");
                if (toFlag == 0)
                {
                    for (int j = 0; j < toArr.Length; j++)
                    {
                        msg.To.Add(toArr[j]);//设置发送给谁
                    }
                    for (int k = 0; k < toArrCC.Length; k++)
                    {
                        msg.CC.Add(toArrCC[k]);//设置CC给谁
                    }
                }
                else
                {
                    msg.To.Add("*****@*****.**");
                }
                logger.Info("Success to load the infos of receivers and cc.");

                MailAddress address = new MailAddress(username); //from
                msg.From    = address;
                msg.Subject = subject;                           //主题设置
                if (!String.IsNullOrWhiteSpace(mailattachments) && System.IO.File.Exists(mailattachments))
                {
                    logger.Info("Begin to load attachments info...");
                    msg.Attachments.Add(new Attachment(mailattachments));
                    logger.Info("Success to load attachments info.");
                }
                else
                {
                    logger.Info("there is not a attachment to load.");
                }
                msg.Body = strAllInfo;
                logger.Info("Success to load the mail's body.");
                msg.SubjectEncoding = encoding;
                msg.BodyEncoding    = encoding;
                msg.IsBodyHtml      = false;
                logger.Info("Success to set the mail's subject and encoding format of body.");
                msg.Priority = MailPriority.High;
                logger.Info("Success to set the mail's priority.");
                object userState = msg;
                try
                {
                    logger.Info("Begin to send mail...");
                    client.Send(msg);
                    logger.Info("Success to send mail.");
                }
                catch (System.Exception ex)
                {
                    logger.Error("Fail to send mail. " + ex.Message);
                }
            }
            catch (System.Exception ex1)
            {
                logger.Error("Error occurs where sending a mail. " + ex1.Message);
            }
            finally
            {
                msg.Dispose();
            }
        }
    protected void lnkView_Click(object sender, EventArgs e)
    {
        GridViewRow grdrow = (GridViewRow)((LinkButton)sender).NamingContainer;
        string      id     = grdrow.Cells[0].Text;

        con.Open();
        cmd = new SqlCommand("select * from filetb where id='" + id + "' ", con);
        SqlDataReader dr = cmd.ExecuteReader();

        if (dr.Read())
        {
            key = dr["Keys"].ToString();
        }
        con.Close();



        con.Open();
        cmd = new SqlCommand("update userfiletb  set Status='Approved',Keys='" + key + "' where id='" + id + "' ", con);
        cmd.ExecuteNonQuery();
        con.Close();
        bind();

        con.Open();
        cmd = new SqlCommand("select * from usertb where UserName='******' ", con);
        SqlDataReader dr1 = cmd.ExecuteReader();

        if (dr1.Read())
        {
            mail = dr1["Email"].ToString();
        }
        con.Close();


        string to   = mail;
        string from = "*****@*****.**";
        // string subject = "Key";
        // string body = TextBox1.Text;
        string password = "******";

        using (MailMessage mm = new MailMessage(from, to))
        {
            mm.Subject = "Keys";
            mm.Body    = "File Id" + id + "Your Download Key:" + key;
            //if (fuAttachment.HasFile)
            //{
            //    string FileName = Path.GetFileName(fuAttachment.PostedFile.FileName);
            //    mm.Attachments.Add(new Attachment(fuAttachment.PostedFile.InputStream, FileName));
            //}
            mm.IsBodyHtml = false;
            SmtpClient smtp = new SmtpClient();
            smtp.Host      = "smtp.gmail.com";
            smtp.EnableSsl = true;
            NetworkCredential NetworkCred = new NetworkCredential(from, password);
            smtp.UseDefaultCredentials = true;
            smtp.Credentials           = NetworkCred;
            smtp.Port = 587;
            smtp.Send(mm);
            ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Mail Send');", true);
        }
    }
예제 #52
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (TextBox2.Text.Trim() == "")
            {
                Label7.Visible = true;
                Label7.Text    = "Insert an email in the textbox.";
            }
            else
            {
                if (!Regex.IsMatch(TextBox2.Text.Trim(), @"^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$"))
                {
                    Label7.Visible = true;
                    Label7.Text    = "Insert an email in the textbox.";
                }
                else
                {
                    string password = Active_Record.Users.GetPasswordByEmail(TextBox2.Text);
                    if (password == null)
                    {
                        Label7.Text    = "There was an error while trying to recover password. Try again later.";
                        Label7.Visible = true;
                    }
                    else if (password == "")
                    {
                        Label7.Text    = "The email inserted was not found on your database. Please check the email inserted.";
                        Label7.Visible = true;
                    }
                    else
                    {
                        string username = Active_Record.Users.GetUsernameByEmail(TextBox2.Text);
                        if (username == null)
                        {
                            Label7.Text    = "There was an error while trying to recover password. Try again later.";
                            Label7.Visible = true;
                        }
                        else if (username == "")
                        {
                            Label7.Text    = "The email inserted was not found on your database. Please check the email inserted.";
                            Label7.Visible = true;
                        }
                        else
                        {
                            string email = Active_Record.Users.GetEmailByUsername(username);
                            if (email == null)
                            {
                                Label7.Text    = "There was an error while trying to recover password. Try again later.";
                                Label7.Visible = true;
                            }
                            else if (email == "")
                            {
                                Label7.Text    = "The email inserted was not found on your database. Please check the email inserted.";
                                Label7.Visible = true;
                            }
                            else
                            {
                                try
                                {
                                    MailMessage mail = new MailMessage();
                                    mail.To.Add(email);
                                    mail.From    = new MailAddress("*****@*****.**", "iRadioDei");
                                    mail.Subject = "iRadioDEI - Password recover";
                                    mail.Body    = "You (or someone) asked to recover the password used in iRadioDEI.\n\nHere are the information about your account:\n\n   Username: "******"\n   Password: "******"\n\n\nIf you don't request to recover your password forget this email.\n\nThank you.\niRadioDEI";
                                    SmtpClient mSmtpClient = new SmtpClient();
                                    mSmtpClient.Send(mail);

                                    TextBox2.Text  = "";
                                    Label8.Visible = true;
                                }
                                catch (Exception ex)
                                {
                                    ex.ToString();
                                    Label7.Text    = "There was an error while trying to recover password. Try again later.";
                                    Label7.Visible = true;
                                }
                            }
                        }
                    }
                }
            }
        }
 public void SetUp()
 {
     lastMailMessageSent = null;
 }
        protected void Button4_Click(object sender, EventArgs e)
        {
            LastADEntities entities = new LastADEntities();

            if (Session["a"] != null)
            {
                list2 = (ArrayList)Session["a"];
            }
            Requisition        rr    = new Requisition();
            List <Requisition> c     = new List <Requisition>();
            List <string>      email = new List <string>();

            foreach (int i in list2)
            {
                rr = entities.Requisitions.Where(x => x.RequId == i).First();
                string emal = rr.Employee.Department.Employees.Where(x => x.RoleId == 5).First().Email.ToString();
                c.Add(rr);
                email.Add(emal);
            }
            for (int i = 0; i < this.GridView1.Rows.Count; i++)
            {
                TextBox    txt          = (TextBox)this.GridView1.Rows[i].Cells[5].FindControl("TextBox1");
                int        RetrievedAmt = Int32.Parse(txt.Text);
                Label      lab          = (Label)this.GridView1.Rows[i].Cells[2].FindControl("Label7");
                RequDetail requDetail   = new RequDetail();
                c = c.Where(x => x.RequDetails.Select(y => y.ItemId).Contains(lab.Text)).OrderBy(x => x.SignDate).ToList();
                foreach (Requisition requ in c)
                {
                    DateTime entryday       = DateTime.Now;
                    int?     RetrievedAmtnt = requ.RequDetails.Where(x => x.ItemId.Equals(lab.Text)).Select(x => x.RequestedQuantity).First();
                    if (RetrievedAmt == 0)
                    {
                    }
                    else if (RetrievedAmt < RetrievedAmtnt)
                    {
                        RetrievedAmtnt = RetrievedAmt;
                    }

                    if (RetrievedAmtnt != 0)
                    {
                        RequDetail requde = new RequDetail();
                        requde = requ.RequDetails.Where(x => x.ItemId.Equals(lab.Text)).First();
                        int         balance = Convert.ToInt32(requde.ItemList.Stock) - Convert.ToInt32(RetrievedAmtnt);
                        Transaction tt      = new Transaction();
                        tt.Balance   = balance;
                        tt.EntryDate = entryday;
                        tt.ItemId    = requde.ItemId;
                        tt.Quantity  = RetrievedAmtnt;
                        tt.Requid    = requde.RequId;
                        ItemList ii = new ItemList();
                        ii       = requde.ItemList;
                        ii.Stock = balance;


                        entities.Transactions.Add(tt);
                        entities.SaveChanges();
                        RetrievedAmt = RetrievedAmt - Convert.ToInt32(RetrievedAmtnt);
                    }
                }
                foreach (Requisition requ in c)
                {
                    requ.Status = "Waiting For Delivery";
                    entities.SaveChanges();
                }
            }
            foreach (string em in email)
            {
                string bossmail = em;
                Business.sendemail();
                MailMessage mm = new MailMessage("*****@*****.**",
                                                 bossmail);
                mm.Subject = "Your Requisition order has been send to your collection point ";
                mm.Body    = "Your Requisition order has been send to your collection point, please collect your item before tmr 12:00pm ";

                Business.sendemail().Send(mm);
            }
            Response.Redirect("DisbursementList.aspx");
        }
예제 #55
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        add(Button7.BackColor, Button7);
        add(Button8.BackColor, Button8);
        add(Button9.BackColor, Button9);
        add(Button10.BackColor, Button10);
        add(Button11.BackColor, Button11);
        add(Button12.BackColor, Button12);
        add(Button13.BackColor, Button13);
        add(Button14.BackColor, Button14);
        add(Button15.BackColor, Button15);
        add(Button16.BackColor, Button16);
        add(Button17.BackColor, Button17);
        add(Button18.BackColor, Button18);
        add(Button21.BackColor, Button21);
        add(Button22.BackColor, Button22);
        add(Button23.BackColor, Button23);
        add(Button24.BackColor, Button24);
        add(Button25.BackColor, Button25);
        add(Button26.BackColor, Button26);

        string         no    = "";
        string         dmail = "";
        SqlDataAdapter daa;
        DataSet        dss = new DataSet();
        string         h   = "select Email from Doctor where Name='" + DropDownList3.SelectedItem + "'";

        daa = new SqlDataAdapter(h, con);
        daa.Fill(dss);
        dmail = dss.Tables[0].Rows[0][0].ToString();

        string umail = Session["email"].ToString();


        string      id         = "*****@*****.**";
        string      pass       = "******";
        MailMessage mail       = new MailMessage();
        SmtpClient  SmtpServer = new SmtpClient("smtp.gmail.com");

        mail.From = new MailAddress(id);
        mail.To.Add(umail);
        mail.Subject = "Doctor Appointment Alert";
        mail.Body    = "Your Appiontment has been booked with Doctor :'" + DropDownList3.Text + "' at Date :'" + Calendar1.SelectedDate.ToShortDateString() + "' Time:'" + Label10.Text + "' ";


        SmtpServer.Port        = 587;
        SmtpServer.Credentials = new System.Net.NetworkCredential(id, pass);
        SmtpServer.EnableSsl   = true;

        SmtpServer.Send(mail);



        MailMessage mail1       = new MailMessage();
        SmtpClient  SmtpServer1 = new SmtpClient("smtp.gmail.com");

        mail1.From = new MailAddress(id);
        mail1.To.Add(dmail);
        mail1.Subject = "Doctor Appiontments Alert";
        mail1.Body    = "Your Appointment has been booked with User Id :'" + Session["id"].ToString() + "' at Date :'" + Calendar1.SelectedDate.ToShortDateString() + "' Time:'" + Label10.Text + "' ";


        SmtpServer1.Port        = 587;
        SmtpServer1.Credentials = new System.Net.NetworkCredential(id, pass);
        SmtpServer1.EnableSsl   = true;

        SmtpServer1.Send(mail1);
        Panel4.Visible  = false;
        Button6.Visible = false;
        Response.Redirect("Book.aspx");
        Page.ClientScript.RegisterStartupScript(GetType(), "msgtype()", "alert('Your appointment is booked...')", true);
    }
예제 #56
0
        /// <summary>
        ///   Sends a message
        /// </summary>
        /// <param name="from">The sender.</param>
        /// <param name="to">The recipient.</param>
        /// <param name="subject">The subject.</param>
        /// <param name="message">The message.</param>
        /// <param name="attachments">The attachments.</param>
        /// <param name="useHtmlBody">
        ///   if set to <c>true</c> [use HTML body].
        /// </param>
        public void send(
            string @from,
            IEnumerable <string> to,
            string subject,
            string message,
            IEnumerable <Attachment> attachments,
            bool useHtmlBody)
        {
            var config = Config.get_configuration_settings();

            var emailMessage = new MailMessage();

            emailMessage.From = new MailAddress(@from);

            if (!string.IsNullOrWhiteSpace(config.TestEmailOverride))
            {
                foreach (string emailAddress in config.TestEmailOverride.Split(',', ';'))
                {
                    emailMessage.To.Add(emailAddress);
                }
            }
            else
            {
                foreach (var emailTo in to)
                {
                    emailMessage.To.Add(emailTo);
                }
            }

            emailMessage.Subject    = subject;
            emailMessage.Body       = message;
            emailMessage.IsBodyHtml = useHtmlBody;
            foreach (var attachment in attachments.or_empty_list_if_null())
            {
                emailMessage.Attachments.Add(attachment);
            }

            this.Log()
            .Info(
                () =>
                "Sending '{0}' a message from '{1}': {2}{3}{4}".format_with(
                    string.Join(",", to),
                    @from,
                    subject,
                    Environment.NewLine,
                    message));

            using (var client = new SmtpClient())
            {
                try
                {
                    client.Send(emailMessage);
                } catch (SmtpException ex)
                {
                    this.Log()
                    .Error(
                        () =>
                        "Error sending email to '{0}' with subject '{1}':{2}{3}".format_with(
                            emailMessage.To.ToString(),
                            emailMessage.Subject,
                            Environment.NewLine,
                            ex));
                }
            }
        }
예제 #57
0
        private void prnt_Click(object sender, EventArgs e)
        {
            SqlConnection  con4 = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=" + GlobalVariable.path + "\\Inv.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
            SqlDataAdapter sda4 = new SqlDataAdapter("Select Item_no,Quantity From Trans where Bill_no = '" + billno.Text + "' ", con4);
            DataTable      dt4  = new DataTable();
            SqlCommand     cmd4 = new SqlCommand();

            sda4.Fill(dt4);
            SqlConnection  con5 = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=" + GlobalVariable.path + "\\Inv.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
            SqlDataAdapter sda5 = new SqlDataAdapter();
            SqlCommand     cmd5 = new SqlCommand();

            cmd5.CommandText   = "INSERT INTO Bill VALUES('" + billno.Text + "','" + label8.Text + "','" + label9.Text + "','" + tqty.Text + "','" + tdiscnt.Text + "','" + tprice.Text + "',' " + dt4.Rows.Count + " ',' " + MainWindow.get_user() + " ')";
            cmd5.CommandType   = CommandType.Text;
            cmd5.Connection    = con5;
            sda5.InsertCommand = cmd5;
            con5.Open();
            sda5.InsertCommand.ExecuteNonQuery();
            con5.Close();

            for (int i = 0; i < dt4.Rows.Count; i++)
            {
                cmd5.CommandText   = "INSERT INTO Bill_details VALUES('" + billno.Text + "','" + dt4.Rows[i].ItemArray[0] + "','" + dt4.Rows[i].ItemArray[1] + " ')";
                cmd5.CommandType   = CommandType.Text;
                cmd5.Connection    = con5;
                sda5.InsertCommand = cmd5;
                con5.Open();
                sda5.InsertCommand.ExecuteNonQuery();
                con5.Close();
            }
            //Resize DataGridView to full height.
            int height = dataGridView1.Height;

            dataGridView1.Height = dataGridView1.RowCount * dataGridView1.RowTemplate.Height;

            //Create a Bitmap and draw the DataGridView on it.
            bitmap = new Bitmap(this.dataGridView1.Width, this.dataGridView1.Height);
            dataGridView1.DrawToBitmap(bitmap, new System.Drawing.Rectangle(0, 0, this.dataGridView1.Width, this.dataGridView1.Height));

            //Resize DataGridView back to original height.
            dataGridView1.Height = height;

            //Show the Print Preview Dialog.
            printPreviewDialog1.Document = printDocument1;
            printPreviewDialog1.PrintPreviewControl.Zoom = 1;
            printPreviewDialog1.ShowDialog();

            cmd5.CommandText = " Delete from Trans ";
            con5.Open();
            cmd5.ExecuteNonQuery();
            con5.Close();
            Int32[] a = new Int32[dt4.Rows.Count];
            Int32[] b = new Int32[dt4.Rows.Count];
            for (int i = 0; i < dt4.Rows.Count; i++)
            {
                a[i] = Convert.ToInt32(dt4.Rows[i].ItemArray[1]);
            }

            for (int i = 0; i < dt4.Rows.Count; i++)
            {
                SqlDataAdapter sda6 = new SqlDataAdapter("Select Tot_qty From Stock_Item where  Item_no= '" + dt4.Rows[i].ItemArray[0] + "' ", con5);
                DataTable      dt5  = new DataTable();
                sda6.Fill(dt5);
                b[i] = Convert.ToInt32(dt5.Rows[0].ItemArray[0]);
                // MessageBox.Show("" + b[i]);
                b[i] = b[i] - a[i];
                //MessageBox.Show("" + b[i]);
            }

            for (int i = 0; i < dt4.Rows.Count; i++)
            {
                //MessageBox.Show("" + b[i]);
                cmd5.CommandText = "UPDATE Stock_Item SET Tot_qty='" + b[i].ToString() + "' WHERE Item_no = '" + dt4.Rows[i].ItemArray[0] + "'";
                cmd5.CommandType = CommandType.Text;
                cmd5.Connection  = con5;

                SqlDataAdapter sda7 = new SqlDataAdapter();
                sda7.UpdateCommand = cmd5;
                con5.Open();
                sda7.UpdateCommand.ExecuteNonQuery();
                con5.Close();
            }
            SqlDataAdapter sda8 = new SqlDataAdapter("Select * From Item i,Stock_Item s where  i.Item_no=s.Item_no and CONVERT(INT,i.Item_cutoff) > CONVERT(INT,s.Tot_qty)", con5);
            DataTable      dt   = new DataTable();

            sda8.Fill(dt);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                try
                {
                    MailMessage msg     = new MailMessage("*****@*****.**", "*****@*****.**", "INVENTORY-ITEM NOTIFICATION", "ORDER FOR ITEM_NO : " + dt.Rows[i].ItemArray[0] + " ITEM_NAME : " + dt.Rows[i].ItemArray[1]);//(from,to,subject,body)
                    SmtpClient  eclinet = new SmtpClient();
                    eclinet.Send(msg);
                }
                catch (Exception ex) { MessageBox.Show(ex.ToString()); }
            }

            this.Hide();
        }
예제 #58
0
        private void btnEnviar1_Click(object sender, EventArgs e)
        {
            if (rbtnAcademia.Checked == true)
            {
                Desde  = "*****@*****.**";
                Clave  = "M123456m";
                Enviar = true;
            }
            else
            {
                Enviar = false;
                frmEnvioMailDesde frm = new frmEnvioMailDesde();
                frm.Owner = this;
                frm.ShowDialog();

                //Desde = "*****@*****.**";
                //Clave = "M123456m";
            }

            if (rbtnTodos.Checked == true)
            {
                Hasta = "*****@*****.**";
            }
            else
            {
                Hasta = "*****@*****.**";
            }

            if (Enviar)
            {
                using (SmtpClient cliente = new SmtpClient("smtp.gmail.com", 587))
                //using (SmtpClient cliente = new SmtpClient("smtp.live.com", 25))
                {
                    cliente.EnableSsl   = true;
                    cliente.Credentials = new NetworkCredential(Desde, Clave);
                    MailMessage mensaje = new MailMessage(Desde, Hasta, txtAsunto.Text, txtDetalle.Text);

                    if (rbtnTodos.Checked == true)
                    {
                        foreach (string item in mailBusiness.listar())
                        {
                            mensaje.Bcc.Add(item.ToString());
                        }
                    }

                    try
                    {
                        cliente.Send(mensaje);
                        MessageBox.Show("El Correo fue Enviado Correctamente.");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
            else
            {
                MessageBox.Show("No se cargo Correo de Profesor.");
            }
        }
    protected void expedite_mailnotification(String Incident, String Urgency_reason)
    {
        SqlConnection conn = new SqlConnection("Data Source=10.238.110.196;Initial Catalog=Expedite;User ID=sa;Password=Orange@123$");
        String x = (string)(Session["FTID"]);
        String group_name = "";
        String assignee_name = "";
        String submitter_mail = "";
        String expeditedby_mail = "";
        String assigned_group = "";
        String tier2 = "";
        String summary = "";
        String Urg_Reason = "";
        try
        {
            DataTable dt = new DataTable();
            conn.Open();
            SqlCommand command = new SqlCommand();
            command.Connection = conn;
            command.CommandText = "SELECT [AG Assigned Group Name],[AG Assignee],[INC CI Email Address],[Expedited_mail],[AG Assigned Group Name],[INC Tier 2],[INC Summary],[Urgency_Reason] FROM [Expedite].[dbo].['All_Incidents'],[Expedite].[dbo].[Expedite_time] where [INC Incident Number]='" + Incident + "';";
            using (SqlDataAdapter sda = new SqlDataAdapter())
            {
                sda.SelectCommand = command;
                using (dt = new DataTable())
                {

                    sda.Fill(dt);

                }
            }
            group_name = dt.Rows[0][0].ToString();
            assignee_name = dt.Rows[0][1].ToString();
            submitter_mail = dt.Rows[0][2].ToString();
            expeditedby_mail = dt.Rows[0][3].ToString();
            assigned_group = dt.Rows[0][4].ToString();
            tier2 = dt.Rows[0][5].ToString();
            summary = dt.Rows[0][6].ToString();
            Urg_Reason = dt.Rows[0][7].ToString();
            conn.Close();
        }
        catch (Exception ex)
        {
            conn.Close();
            Console.Write(ex.ToString());
        }

        MailMessage mail = new MailMessage();
        SmtpClient SmtpServer = new SmtpClient("mx-us.equant.com");
        mail.From = new MailAddress("*****@*****.**");
        //Debug.Write(submitter_mail);
        mail.CC.Add(submitter_mail);
            mail.To.Add(Session["Email"].ToString());
        //mail.To.Add("*****@*****.**");
        mail.CC.Add("*****@*****.**");
        mail.Subject = "Expedited Incident " + Incident;
        mail.Body = "Hello " + (string)Session["Fname"] + "," + "\n" + "Thank you for using the Expedite Portal." + "\n" + "Kindly note that the incident with reference " + Incident + " regarding " + tier2 + " has been expedited with urgency reason " + Urg_Reason + "." + "\n" + "Incident is now assigned to group: " + group_name + " which is managed by " + getmanagername(getmanagerofinc(Incident)) + "\n" + "To check the update of this issue, please check your Expedited Incidents tab on: http://cas-its4b.vdr.equant.com/expedite/" + "\n" + "We assure you that the IT Support for business Team will put every effort into resolving this issue as soon as possible." + "\n" + "Regards," + "\n" + "IT Support for Business team";
        SmtpServer.Send(mail);
        Debug.WriteLine(mail.Body);
        MailMessage mail2 = new MailMessage();
        SmtpClient SmtpServer2 = new SmtpClient("mx-us.equant.com");
        mail2.From = new MailAddress("*****@*****.**");
        ArrayList teamlist = getteamlist(assigned_group);
        foreach (String team_member in teamlist)
        {
            mail2.To.Add(team_member);
        }
        //mail2.To.Add("*****@*****.**");
        mail2.CC.Add("*****@*****.**");
        mail2.Subject = "Expedited Incident " + Incident;
        mail2.Body = "Hello Team," + "\n" + "Thanks to note that the subjected incident is expedited by the user with urgency reason " + Urg_Reason + ". Appreciate if you can check the incident on priority and feedback us accordingly." + "\n" + "Your fast action is highly appreciated." + "\n" + "You can also check the expedited incidents that are in your queue in the Expedited Incidents Tab (if any) on: http://cas-its4b.vdr.equant.com/expedite/" + "\n" + "Regards," + "\n" + "IT Support for Business team";
        Debug.WriteLine(mail2.Body);
        SmtpServer2.Send(mail2);
    }