public void SendEmail(FloodingRequest floodingRequest, string caseReference) { if (string.IsNullOrEmpty(floodingRequest.Reporter.EmailAddress)) { return; } EMailTemplate template; var templateNotFound = false; var value = floodingRequest.WhatDoYouWantToReport.Equals("highWaterLevels") ? floodingRequest.WhatDoYouWantToReport : floodingRequest.WhereIsTheFlood; switch (value) { case "pavement": case "road": case "parkOrFootpath": template = EMailTemplate.ReportAFloodPublicSpaces; break; case "privateLand": case "home": case "business": template = EMailTemplate.ReportAFloodPrivateSpaces; break; case "highWaterLevels": template = EMailTemplate.ReportAFloodHighWaterLevels; break; default: templateNotFound = true; template = EMailTemplate.BaseTemplate; _logger.LogWarning($"MailHelper:: SendEmail:: Email not sent, no email template found for {floodingRequest.WhereIsTheFlood} journey"); break; } if (!templateNotFound) { try { _mailingServiceGateway.Send(new Mail { Payload = JsonConvert.SerializeObject(new { Subject = template.Equals(EMailTemplate.ReportAFloodHighWaterLevels) ? "Thanks for reporting high water levels on a river or stream" : "Thanks for reporting a flood", Reference = caseReference, RecipientAddress = floodingRequest.Reporter.EmailAddress }), Template = template }); } catch (Exception ex) { throw ex; } } }
public async Task <string> CreateCase(ContactSTARTRequest request) { if (!verintConfiguration.ClassificationMap.TryGetValue(request.AreaOfConcern.Trim(), out var eventCode)) { throw new Exception("ContactSTARTService.CreateCase: EventCode not found"); } var response = await verintServiceGateway.CreateCase(request.MapToCase(eventCode)); if (!response.IsSuccessStatusCode) { throw new Exception($"ContactSTARTService.CreateCase: the status code {response.StatusCode} indicates something has gone wrong when attempting to create a case within verint-service."); } if (request.IsAboutSelf && !string.IsNullOrEmpty(request.RefereePerson.EmailAddress)) { _ = mailingServiceGateway.Send(new Mail { Template = EMailTemplate.ContactStartRequest, Payload = JsonConvert.SerializeObject(new { Reference = response.ResponseContent, request.RefereePerson.FirstName, RecipientAddress = request.RefereePerson.EmailAddress, Subject = "Thank you for contacting START" }) }); } return(response.ResponseContent); }
public async Task <string> CreateCase(LibraryVolunteeringEnquiry enquiry) { var response = await _verintServiceGateway.CreateCase(enquiry.MapToCase( _verintConfiguration.EventCode, _verintConfiguration.Classification)); if (!response.IsSuccessStatusCode) { throw new Exception("LibraryVolunteeringEnquiryService.CreateCase: VerintServiceGateway status code indicated the case was not created."); } if (!string.IsNullOrEmpty(enquiry.Email)) { _ = _mailingServiceGateway.Send(new Mail { Template = EMailTemplate.LibraryVolunteeringEnquiry, Payload = JsonConvert.SerializeObject(new { enquiry.FirstName, Reference = response.ResponseContent, RecipientAddress = enquiry.Email, Subject = "Library Volunteering Enquiry" }) }); } return(response.ResponseContent); }
private void SendUserSuccessEmail(ComplaintDetails model, string caseResponse) { var submissionDetails = new ComplaintsMailModel() { Subject = "We've received your formal complaint", Reference = caseResponse, FirstName = model.ContactDetails.FirstName, LastName = model.ContactDetails.LastName, RecipientAddress = model.ContactDetails.EmailAddress }; _mailingServiceGateway.Send(new Mail { Payload = JsonConvert.SerializeObject(submissionDetails), Template = EMailTemplate.ComplaintsSuccess }); }
public void SendEmail(Person person, EMailTemplate template, string caseReference) { _mailingServiceGateway.Send(new Mail { Template = template, Payload = JsonConvert.SerializeObject(new { Subject = "Bridges or Structures Report - submission", Reference = caseReference, FirstName = person.FirstName, LastName = person.LastName, RecipientAddress = person.Email }) }); }
public void SendEmail(Person person, EMailTemplate template, string caseReference) { _mailingServiceGateway.Send(new Mail { Template = template, Payload = JsonConvert.SerializeObject(new { Subject = "Parking dispensation request form - submission", Reference = caseReference, FirstName = person.FirstName, LastName = person.LastName, RecipientAddress = person.Email }) }); }
public void SendEmail(Person person, EMailTemplate template, string caseReference, StockportGovUK.NetStandard.Models.Addresses.Address street) { AbandonedVehicleMailModel submissionDetails = new AbandonedVehicleMailModel(); _logger.LogInformation(caseReference, street, person); submissionDetails.Subject = "Abandoned Vehicle Report - submission"; submissionDetails.Reference = caseReference; submissionDetails.StreetInput = street.SelectedAddress; submissionDetails.FirstName = person.FirstName; submissionDetails.LastName = person.LastName; submissionDetails.RecipientAddress = person.Email; _mailingServiceGateway.Send(new Mail { Payload = JsonConvert.SerializeObject(submissionDetails), Template = template }); }
public void SendEmail(Person person, EMailTemplate template, string caseReference, Address street) { StreetReportMailModel submissionDetails = new StreetReportMailModel(); _logger.LogInformation(caseReference, street, person); submissionDetails.Subject = "Dropped kerb request - submission"; submissionDetails.Reference = caseReference; submissionDetails.FormType = FormType.request; submissionDetails.ConcerningDescription = "a dropped kerb"; submissionDetails.StreetInput = street.SelectedAddress; submissionDetails.RecipientAddress = person.Email; _mailingServiceGateway.Send(new Mail { Payload = JsonConvert.SerializeObject(submissionDetails), Template = template }); }