Пример #1
0
        public bool SendMailToBusinessUser(int auctionId)
        {
            try
            {
                User   user    = userCRUD.FindUserByAuctionId(auctionId);
                string to      = user.Email;
                string from    = "*****@*****.**";
                string subject = "Someone sent you an offer!";

                string body = String.Format(@"
                                    Hello {0}! 
                                    An Influencer has sent an offer to one of your auctions!
                                    Please take a look at your profile.
                                    Cheers,
                                    Its a deal team", user.Name);


                MailMessage mail   = new MailMessage(from, to, subject, body);
                SmtpClient  client = new SmtpClient("smtp.gmail.com");
                client.Credentials = new NetworkCredential("*****@*****.**", "Aa@123456");
                client.Port        = 25;
                client.EnableSsl   = true;
                client.Send(mail);
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);
            }
        }