Esempio n. 1
0
        public void SendMail(string smtpAddress, string from, string to, string cc, string replyTo, string body, string subject, bool isHtml)
        {
            MailMessage email = new MailMessage();

            email.From = new MailAddress("*****@*****.**", "Streebo Metis");
            if (replyTo != String.Empty)
            {
                email.ReplyTo = new MailAddress(replyTo);
            }

            Dictionary <string, string> lstResourceWithEmail = new Dictionary <string, string>();

            objBLL = new MetisBLL();
            DataTable dtable = objBLL.getAllResourcesWithEmail();

            email.To.Add(to);

            if (cc != String.Empty)
            {
                email.CC.Add(cc);
            }

            email.Body       = body;
            email.Subject    = subject;
            email.IsBodyHtml = isHtml;
            //email.Attachments.Add(new Attachment(attachmentStream, fileName));

            SmtpClient smtp = new SmtpClient("localhost", 587);

            smtp.Host        = "smtp.gmail.com"; //Or Your SMTP Server Address
            smtp.Credentials = new System.Net.NetworkCredential
                                   ("*****@*****.**", "Inbox@1234");
            //Or your Smtp Email ID and Password
            smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
            smtp.EnableSsl      = true;
            smtp.Send(email);
        }