示例#1
0
        public bool Send(EmailDto emailDto)
        {
            var result = true;

            try
            {
                foreach (var destination in emailDto.EmailAndTokenTo.Values)
                {
                    var mymsg = new EmailMessage("My Thai Star Restaurant booking stastus", "My Thai Star Restaurant", emailDto.EmailFrom, new List <string> {
                        destination
                    });

                    var body = PopulateEmailBody(emailDto, destination);


                    mymsg.AddBody(body, new List <string> {
                        GeFilePath("mui-email-inline.css"), GeFilePath("mui-email-styletag.css")
                    }, EmailBodyType.HtmlText);
                    mymsg.AddBody(body, new List <string>(), EmailBodyType.HtmlText);

                    var gmailMessageSender = new GoogleEmail();
                    gmailMessageSender.SendMessage(GmailServiceInstance, Credential.UserId, mymsg.GetEmailMessage());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{ex.Message} : {ex.InnerException}");
                result = false;
            }

            return(result);
        }