public RevisionForm() { InitializeComponent(); validator = new RevisionFormValidationOne(); revisionForm = new RevisionFormVM(); }
public RevisionNewEstimate() { InitializeComponent(); validator = new RevisionFormValidationTwo(); revisionForm = new RevisionFormVM(); }
public async Task <Response> SendEmail(RevisionFormVM revisionFormVM) { Response response = new Response(); try { response = JsonConvert.DeserializeObject <Response>(await client.PostAsync($"{BaseUrl}Email/SendEmail", revisionFormVM)); } catch (Exception ex) { } return(response); }
public async Task <Response> SendEmail(RevisionFormVM revisionFormVM) { Response response = new Response(); try { EmailMessage message = new EmailMessage(); message.Sender = new MailboxAddress("MOVE US TO RELOCTION", _notificationMetadata.Sender); message.Reciever = new MailboxAddress("MOVE US TO RELOCTION", _notificationMetadata.Reciever); message.Subject = "Revised Estimate"; message.Content = "Interstate Revised Written Estimate"; string html = CreateEmailPdf(revisionFormVM); MimeMessage mimeMessage = CreateMimeMessageFromEmailMessage(message, html); using (SmtpClient smtpClient = new SmtpClient()) { smtpClient.Connect(_notificationMetadata.SmtpServer, _notificationMetadata.Port, _notificationMetadata.EnableSsl); smtpClient.Authenticate(_notificationMetadata.UserName, _notificationMetadata.Password); await smtpClient.SendAsync(mimeMessage); smtpClient.Disconnect(true); } response.Message = "Email sent successfully"; response.Status = ResponseStatus.OK; } catch (Exception ex) { response.Message = ex.Message; response.Status = ResponseStatus.Error; } return(response); }
private string CreateEmailPdf(RevisionFormVM revisionFormVM) { return(RenderViewToString("EmailTemplates/Estimate2018Front.html", revisionFormVM)); }
public async Task <Response> SendEmail([FromBody] RevisionFormVM revisionFormVM) { return(await service.SendEmail(revisionFormVM)); }