Example #1
0
        public async Task <ActionResult> Contact(EmailModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    //var body = "<p>Email From: <bold>{0}</bold>({1})</p><p>Message:</p><p>{2}</p>";
                    var from = $"{model.FromEmail}<{WebConfigurationManager.AppSettings["emailto"]}>";
                    //model.Body = "This is a message from your portfolio site. The name and the email of the contacting person is above.";
                    var email = new MailMessenger(from, WebConfigurationManager.AppSettings["emailto"])
                    {
                        Subject    = model.Subject,
                        Body       = model.Body,
                        IsBodyHtml = true
                    };
                    var sync = new PersonalEmail();
                    await svc.SendAsync(email);

                    return(View(new EmailModel()));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    await Task.FromResult(0);
                }
            }
            return(View(model));
        }
Example #2
0
 internal static Task SendAsync(MailMessenger email)
 {
     throw new NotImplementedException();
 }