コード例 #1
0
 public void sendEmail(EmailObject email)
 {
     MailMessage mail = new MailMessage("*****@*****.**", "*****@*****.**");
     SmtpClient client = new SmtpClient();
     client.Port = 25;
     client.DeliveryMethod = SmtpDeliveryMethod.Network;
     client.UseDefaultCredentials = false;
     client.Host = "192.168.1.17";
     mail.Subject = email.MailSubject;
     mail.Body = email.MailBody;
     client.Send(mail);
 }
コード例 #2
0
        public void sendAlertEmail(List<IPhoneStatus> iphoneList)
        {
            if (iphoneList.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("Dear Mdm/ Sir, \r\n");
                sb.Append("Good News, below are the available Sintel Shop to sign: \r\n ");
                foreach (var item in iphoneList)
                {
                    sb.Append(item.branch + "\r\n");
                }

                EmailObject email = new EmailObject();
                email.MailBody = sb.ToString();
                email.MailSubject = "64GB IPhone 6s Rosegold Avaliable for below Singtel Shop";

                sendEmail(email);
            }
        }