public JsonResult post(EmailBody em) { bool foundemail = true; string to = em.Email; string email = em.Email.ToString(); int index = email.IndexOf("@"); string name = email.Substring(0, index); string subject = "Desease Alert"; string areaName = em.Area; string desease = "Apple Black Rot"; string body = "Hi " + name + "! , \n A new desese has stricked in following area: " + areaName + "\nYour plants may get infected with following desease:" + desease + "\nKindly take precautions \n for any further queries please contact Us \n regards Plantdeseasedetection Admin!"; MailMessage mm = new MailMessage(); mm.To.Add(to); mm.Subject = subject; mm.Body = body; mm.From = new MailAddress("*****@*****.**"); mm.IsBodyHtml = false; SmtpClient smtp = new SmtpClient("smtp.gmail.com"); smtp.Port = 587; smtp.UseDefaultCredentials = true; smtp.EnableSsl = true; smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "033142fazi"); smtp.Send(mm); return(new JsonResult(foundemail.ToString())); }
public void directcreditbyadmin(int CustomerId, string firstname, decimal ordertotal) { try { var subject = " Credits added to your account. "; var cust = CustomerService.GetCustomerById(CustomerId); var Email = cust.Email; var url = string.Format("/Dashboard/"); var link = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, url); string header = EmailBody.MailHeader(subject, LinkedInDemo.Class.AdminSiteConfiguration.GetURL()); string footer = EmailBody.MailFooter(LinkedInDemo.Class.AdminSiteConfiguration.CompanyEmail); string body = "<tr>"; body = body + "<td style='text-align:left; padding: 0px 30px;'>"; body = body + "<p>Dear User,"; body = body + " " + ordertotal + " Credits is added to your account.<br/>Visit your dashboard to check and use these credits for your events.</p>"; body = body + "<a href='" + link + "'><button> Go To Dashboard </button></a><br/>"; body = body + "If you have any queries, please email us on [email protected].<br/>"; body = body + "Thank you for using EventNX."; body = body + "</td></tr>"; string mailbody = header + body + footer; SendMailService.SendMail(Email, subject, mailbody); } catch (Exception ex) { } }
static void Main(string[] args) { EmailBody bodyTest = new EmailBody(@"C:/Users/Richmond/Google Drive/Research/Programs/EnergyEmailer/EnergyEmailer/bin/Debug/ReportCard_Control.html"); //Console.WriteLine(bodyTest.Generate("1111", 13.5, 5.5, 2)); MailMessage mailMsg = new MailMessage(); mailMsg.To.Add("*****@*****.**"); mailMsg.From = new MailAddress("*****@*****.**"); ; mailMsg.IsBodyHtml = true; // Subject and Body mailMsg.Subject = "Energy use report card"; mailMsg.Body = bodyTest.Generate("123", 4.5, 10.564, 3); // Init SmtpClient and send on port 587 in my case. (Usual=port25) SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587); smtpClient.EnableSsl = true; System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("rbstarbuck", "Poopoo8594"); smtpClient.Credentials = credentials; smtpClient.Send(mailMsg); Console.ReadKey(); }
public ActionResult ForgotPassword(ForgotPasswordmodel model) { var customer = CustomerService.GetCustomerByEmail(model.Email); if (customer == null) { ViewBag.error = "You are not registered yet"; return(View(model)); } var url = string.Format("/Account/ResetPassword/{0}", customer.ActivationCode); var link = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, url); string subject = "Forgot Password "; string header = EmailBody.MailHeader(subject, LinkedInDemo.Class.AdminSiteConfiguration.GetURL()); string footer = EmailBody.MailFooter(LinkedInDemo.Class.AdminSiteConfiguration.CompanyEmail); string body = "<tr>"; body = body + "<td style='text-align:left; padding: 0px 30px;'>"; body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'> Dear User, </p>"; body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000; line-height: 22px;'> Please click on the following link in order to reset your account password.</p>"; body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'><a href='" + link + "' style='text-decoration: none; color: #d21180;'> Forgot Password ! </a></p><br />"; body = body + "<p style='margin: 0px; padding: 0px 0px 0px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000; line-height: 22px;'><b>Cheers,</b> <br />" + LinkedInDemo.Class.AdminSiteConfiguration.SiteName + " Team</p>"; body = body + "</td></tr>"; //body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000;'><a href='" + link + "'> Forgot Password ! </a>"; //body = body + "</p><br/>"; //body = body + "<p style='margin: 0px; padding: 0px 0px 20px 0px; font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #000; line-height: 22px;'>Cheers, <br />" + LinkedInDemo.Class.AdminSiteConfiguration.SiteName + " Team</p>"; string mailbody = header + body + footer; SendMailService.SendMail(model.Email, subject, mailbody); ViewBag.success = "Password reset link sent"; return(View(model)); }
static void Main(string[] args) { EmailBody bodyTest = new EmailBody(@"C:/Users/Richmond/Google Drive/Research/Programs/EnergyEmailer/EnergyEmailer/bin/Debug/ReportCard_Control.html"); //Console.WriteLine(bodyTest.Generate("1111", 13.5, 5.5, 2)); MailMessage mailMsg = new MailMessage(); mailMsg.To.Add("*****@*****.**"); mailMsg.From = new MailAddress("*****@*****.**");; mailMsg.IsBodyHtml = true; // Subject and Body mailMsg.Subject = "Energy use report card"; mailMsg.Body = bodyTest.Generate("123", 4.5, 10.564, 3); // Init SmtpClient and send on port 587 in my case. (Usual=port25) SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587); smtpClient.EnableSsl = true; System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("rbstarbuck", "Poopoo8594"); smtpClient.Credentials = credentials; smtpClient.Send(mailMsg); Console.ReadKey(); }
public void Constructor_Works() { const string FromAddress = "*****@*****.**"; var emptyToAddressList = new List <string>(); var toAddressList = new List <string> { "*****@*****.**" }; const string Subject = "Subject"; var emailBody = new EmailBody("Tra", false); ConstructorTestBuilderFactory.Constructing <Email>() .UsingDefaultConstructor() .WithArgumentValues(FromAddress, toAddressList, Subject, emailBody) .Maps() .ToProperty(f => f.Body).WithValue(emailBody) .ToProperty(f => f.FromAddress).WithValue(FromAddress) .ToProperty(f => f.Subject).WithValue(Subject) .ToProperty(f => f.ToAddresses).WithValue(toAddressList) .BuildMaps() .WithArgumentValues(null, toAddressList, Subject, emailBody) .Fails() .WithArgumentValues(FromAddress, emptyToAddressList, Subject, emailBody) .Fails() .WithArgumentValues(FromAddress, toAddressList, null, emailBody) .Fails() .WithArgumentValues(FromAddress, toAddressList, Subject, string.Empty) .Fails() .Assert(); }
public void SendEmail(EmailAddress from, EmailAddress to, string subject, EmailBody body) { Console.WriteLine("Sending email"); Console.WriteLine("From: " + from.Value); Console.WriteLine("To: " + to.Value); Console.WriteLine("Subject: " + subject); Console.WriteLine("Body: " + body.Value); }
public async Task SendEmailAsync(string recip, string subj, string body) { var msg = new EmailBody { HtmlBody = body }; await this.SendEmailAsync(recip, subj, msg).ConfigureAwait(false); }
public async Task SendEmailAsync(string recip, string subj, string body) { var msg = new EmailBody { HtmlBody = body }; await this.SendEmailAsync(recip, subj, msg).AwaitBackground(); }
public void TestMail() { var body = new EmailBody() { Html = "<p>Dit is een test!</p>", Text = "Dit is een test!" }; _mailService.Send("*****@*****.**", "Test from SendGrid", body); }
public void ResetPasswordTest() { // TODO: add unit test for the method 'ResetPassword' string appId = null; // TODO: replace null with proper value EmailBody body = null; // TODO: replace null with proper value var response = instance.ResetPassword(appId, body); Assert.IsInstanceOf <string> (response, "response is string"); }
public void ComposeEmailAndSaveDraft(string addressee, string subject, string body) { Addressee.SendKeys(addressee); Subject.SendKeys(subject); GetDriver().SwitchTo().Frame(EmailBodyFrame); EmailBody.Clear(); EmailBody.Click(); EmailBody.SendKeys(body); GetDriver().SwitchTo().DefaultContent(); SaveButton.Click(); }
public void SendEmail(EmailBody emailBody, EmailConfiguration emailConfig) { try { CommonUtility.Common.Email objEmail = new CommonUtility.Common.Email(); objEmail.SendEmail(emailBody, emailConfig); } catch (Exception ex) { throw ex; } }
public EtsyOrder(string plainTextEtsyOrderEmail, string HTMLOrderEmail) : base(plainTextEtsyOrderEmail) { string orderRegex = "Transaction ID(.|\\r|\\n)*?price:.*"; var matches = Regex.Matches(EmailBody, orderRegex); var matchStrings = from Match item in matches select item.Groups[0].Value; InitializeEtsyEmailTransactions(matchStrings.ToList()); string orderNotePattern = "Note [^\n]*\n-*(.*?)-{10}"; string noOrderNotesPattern = "The buyer did not leave a note."; var orderNote = Regex.Match(EmailBody, orderNotePattern, RegexOptions.Singleline).Groups[1].Value; if (!orderNote.Contains(noOrderNotesPattern)) { Notes = orderNote; } if (EmailBody.Contains("Marked as gift")) { MarkedAsGift = true; } OrderID = MatchRegex(OrderURLPattern, 1); SalesTax = MatchNumber(@"Tax\:\s *\$([^\n]*)", 1); Customer.Email = MatchRegex(@"Email\s*([^\n\r]*)?", 1); Customer.Username = MatchRegex(@"Note from\s*([^\n\r]*)?", 1); OrderTotal = MatchNumber(@"Order Total\:\s*\$\s*([^\n\r]*)?", 1); ShippingCharge = MatchNumber(@"Shipping\s*\:\s*\$\s*([^\s\n\r\(\)]*)", 1); ImageURL = Regex.Match(HTMLOrderEmail, @"(https:\/\/i.etsystatic.com\/.*)\""")?.Groups[1]?.Value; if (Regex.Match(plainTextEtsyOrderEmail, "ICANWAIT", RegexOptions.Singleline).Success) { ProcessingTimeInDays = 15; } var processingTimeFromEmail = Regex.Match(HTMLOrderEmail, @"Processing time.*?(\d+)\s(weeks|business days)", RegexOptions.Singleline); if (processingTimeFromEmail.Success) { var multiplier = (processingTimeFromEmail.Groups[2].Value == "weeks") ? 5 : 1; // use 5 for weeks since it is in business days ProcessingTimeInDays = int.Parse(processingTimeFromEmail.Groups[1].Value) * multiplier; } else // if we cant figure out the processing time from etsy, try to do it from the product processing times in airtable { var transactionsProcessingTimeList = (from txn in Transactions where txn.ProductData != null select txn.ProductData.ProcessingTime).ToList(); if (transactionsProcessingTimeList.Count > 0) { ProcessingTimeInDays = Math.Max(transactionsProcessingTimeList.Max(), EtsyMinimumProcessingDays); } } }
private static EmailBody Map(EMailHtmlBodyDTO emailBodyDTO) { EmailBody emailBody = new EmailBody(); if (emailBodyDTO != null) { emailBody.IsMessageHTML = true; emailBody.Message = emailBodyDTO.BodyTekst; emailBody.HTMLEmbeddedImages.AddRange(Map(emailBodyDTO.IndlejretBilleder)); } return(emailBody); }
public EmailBody GetEmailBody(string email_Id, string cc, string bcc, string subject, string body) { var usermodel = new EmailBody() { To = email_Id, CC = cc, BCC = bcc, Subject = subject, Body = body, }; return(usermodel); }
public async Task SendEmailAsync(string recip, string subj, EmailBody body) { var msg = new MailMessage { From = new MailAddress(this._options.From, this._options.FromName), IsBodyHtml = true, Body = body.HtmlBody, Subject = subj }; msg.To.Add(recip); await this._client.SendMailAsync(msg).AwaitBackground(); }
private static EmailBody ProcessMailPartsRecursively(string partBody, string boundary, int recursionLevel = 0) { if (string.IsNullOrEmpty(partBody) || string.IsNullOrEmpty(boundary)) { return(null); } boundary = boundary.EscapeRegexpSpecialChars(); var re = new Regex(string.Format(MailPartDividerPattern, boundary), RegexOptions.IgnoreCase | RegexOptions.Singleline); var parts = re.Matches(partBody); var count = parts.Count; EmailBody result = null; for (var i = count - 1; i >= 0; i--) { var part = parts[i]; var contentType = part.Value.GetHeaderValue("content-type"); var headerCharset = part.Value.GetHeaderValue("content-type", "charset"); if (IsMultipartContent(contentType)) { var subBoundary = part.Value.GetHeaderValue("content-type", "boundary"); result = ProcessMailPartsRecursively(part.Value, subBoundary, ++recursionLevel); } if (result != null) { break; } if (!contentType.Equals(HtmlContentType, StringComparison.InvariantCultureIgnoreCase) && (i > 0 || recursionLevel != 0)) { continue; } var match = new Regex(MailPartDetailsPattern, RegexOptions.Singleline).Match(part.Value); result = new EmailBody { Content = match.Value, ContentType = contentType, ContentEncoding = part.Value.GetHeaderValue("content-transfer-encoding"), Charset = headerCharset }; break; } return(result); }
private Task <Response> Execute(string recip, string subj, EmailBody body) { var client = new SendGridClient(this._options.Key); body.AddRecip(recip); body.FromEmail = this._options.From; body.FromName = this._options.FromName; body.Subject = subj; var msg = body.BuildSendgridMessage(); return(client.SendEmailAsync(msg)); }
public bool Notify(string recipientIdentifier, EmailBody emailBody, string subject = null) { try { UserAccounts.Data.User user = ValidateRecipientOrDie(recipientIdentifier); NotifyUser(user, emailBody, subject); return(true); } catch (Exception ex) { Logger.AddEntry("Error sending notification to ({0}): {1}", ex, recipientIdentifier, ex.Message); return(false); } }
public static async Task SendEmail(string to, string subject, string content) { //initialization of library Pepipost.PepipostClient client = new Pepipost.PepipostClient(); EmailController email = client.Email; EmailBody body = new EmailBody(); string apiKey = _options["PEPIPOST_API_KEY"]; //Add your Pepipost APIkey from panel here body.Personalizations = new List <Personalizations>(); Personalizations body_personalizations_0 = new Personalizations(); // List of Email Recipients body_personalizations_0.Recipient = to; //To/Recipient email address body_personalizations_0.Attributes = APIHelper.JsonDeserialize <Object>("{}"); body.Personalizations.Add(body_personalizations_0); body.From = new From(); // Email Header body.From.FromEmail = "*****@*****.**"; //Sender Email Address. Please note that the sender domain @exampledomain.com should be verified and active under your Pepipost account. body.From.FromName = "EMSfIIoT"; //Sender/From name //Email Body Content body.Subject = subject; //Subject of email body.Content = content; body.Settings = new Settings { Footer = 0, Clicktrack = 1, //Clicktrack for emails enable=1 | disable=0 Opentrack = 1, //Opentrack for emails enable=1 | disable=0 Unsubscribe = 1 //Unsubscribe for emails enable=1 | disable=0 }; SendEmailResponse result = await email.CreateSendEmailAsync(apiKey, body); try { if (result.Message.Contains("Error")) { Console.WriteLine("\n" + "Message ::" + result.Message + "\n" + "Error Code :: " + result.ErrorInfo.ErrorCode + "\n" + "Error Message ::" + result.ErrorInfo.ErrorMessage + "\n"); } else { Console.WriteLine("\n" + "Message ::" + result.Message); } } catch (APIException) { }; }
public EmailBody PassEmailBodyParams(Message emailFullResponse) { var body = emailFullResponse.Snippet; var decryptedEmail = _encrypt.Base64Encrypt(body); EmailBody emailBody = new EmailBody { Body = decryptedEmail, }; _context.EmailBodies.AddAsync(emailBody); _context.SaveChangesAsync(); return(emailBody); }
public void Get(SnedEmailReq request) { var currenrUser = WindowsHelper.GetUserFromAD(WindowsHelper.WindowsUserName);; var ToEmailList = GetToEmailList(); var emailBuilder = new StringBuilder(); emailBuilder.Append("**************************************************************************************** </br>"); emailBuilder.Append("<b>This is Pending Request Notification.</b> </br>"); if (ConfigHelper.COPApplEnv != "Production") { emailBuilder.Append("If this had been production, the following email would have been sent to:</br>"); foreach (var ToEmail in ToEmailList) { emailBuilder.Append(ToEmail + "</br>"); } ToEmailList = new List <string> { currenrUser.Email }; } emailBuilder.Append("**************************************************************************************** </br>"); emailBuilder.Append("New record (Surname: <b>" + request.Surname + "</b>, Forename:<b> " + request.Forename + "</b>) has been created in UK Headcount Tool."); emailBuilder.Append("<p><font size=" + @"""4""" + " color=" + @"""#CC3300""" + ">Action Required:</font><font size=" + @"""3""" + "> Please update security related fields.</font></p>"); var emailBodyParams = new EmailBodyParams { AppName = ConfigHelper.ApplicationName + " Tool", TextTop = emailBuilder.ToString(), LinkUrl = ConfigHelper.AppUrl + "#/pendingRequest", LinkText = "Click here to view pending requests", TextBottom = "This email was automatically generated by [" + ConfigHelper.ApplicationName + " Tool], please do not reply." }; MessageParams msgParams = null; msgParams = new MessageParams { Subject = "UK Headcount Tool | New Record Created", To = ToEmailList, From = "*****@*****.**", Body = EmailBody.Render(emailBodyParams), CopApplEnv = ConfigHelper.COPApplEnv, NonProductionEmail = currenrUser.Email, SendToOriginalRecipients = true }; ValidateAndSend(msgParams, false); }
public async Task DoWork() { var promotions = await _service.GetPromotions(); var soonToStart = promotions.Where(p => (DateTime.Now - p.StartDate).Days <= 2); var emailBody = new EmailBody { Subject = "Soon to start promotions", Text = File.ReadAllText(_bodyTemplatePath), IsHtml = true }; if (soonToStart.Any()) { await _emailService.SendEmailAsync("*****@*****.**", emailBody); } }
public string CreateEmailBody(EmailBody eb) { string path = ""; switch (eb.TemplateType) { case EmailFileType.FORGOTPW: path = "/Content/EmailTemplate/ForgotPassword.html"; break; case EmailFileType.REGISTER: path = "/Content/EmailTemplate/register.html"; break; case EmailFileType.SUBSCRIPTION: path = "/Content/EmailTemplate/Subscription.html"; break; case EmailFileType.CAMPAIGN: path = "/Content/EmailTemplate/Campaign.html"; break; case EmailFileType.AUTOSUBSCRIPTION: path = "/Content/EmailTemplate/AutoSubscription.html"; break; default: path = "/Content/EmailTemplate/Default.html"; break; } using (StreamReader style = new StreamReader(HostingEnvironment.MapPath("/Content/EmailTemplate/StyleSheet1.css"))) { css = style.ReadToEnd(); } using (StreamReader reader = new StreamReader(HostingEnvironment.MapPath(path))) { template = reader.ReadToEnd(); } DateTime date = DateTime.Now; string url = (isLocal == true ? "http://localhost:3024/" : "https://teamprospect.azurewebsites.net/"); template = template.Replace("{css}", css).Replace("{url}", url).Replace("{token}", eb.Token).Replace("{invoice}", eb.Invoice.ToString()).Replace("{date}", date.ToString()).Replace("{card}", eb.CardType).Replace("{price}", eb.Price.ToString()).Replace("{lastFour}", eb.LastFour.ToString()); return(template); }
public void Send(EmailBody emailBody) { SmtpClient client = new SmtpClient(_smtpConfig.Server, _smtpConfig.Port); client.EnableSsl = true; client.UseDefaultCredentials = false; client.Credentials = new NetworkCredential(_smtpConfig.Username, _smtpConfig.Password); MailMessage mailMessage = new MailMessage(); mailMessage.From = new MailAddress(emailBody.From); mailMessage.To.Add(emailBody.To); mailMessage.Body = emailBody.Content; mailMessage.Subject = emailBody.Subject; mailMessage.IsBodyHtml = true; client.Send(mailMessage); }
public EmailService(IConfiguration config, IUserRepository userRepo, ILogger <EmailService> logger, ISubmissionObjectRepository submissionRepo, EmailBody emailBody, IFeebackMessageRepository feedbackRepo, IUnitOfWork unitOfWork) { _config = config; SenderName = config.GetValue <string>("Smtp:SenderName"); SenderAddress = config.GetValue <string>("Smtp:SenderAddress"); Thumbprint = config.GetValue <string>("Smtp:Thumbprint"); SmtpServer = config.GetValue <string>("Smtp:Server"); SmtpPort = config.GetValue <int>("Smtp:Port"); _userRepo = userRepo; _logger = logger; _submissionRepo = submissionRepo; _emailBody = emailBody; _feedbackRepo = feedbackRepo; _unitOfWork = unitOfWork; }
private void Send(EmailSender emailSender, EmailNotficationData item) { using (var repo = new ToDoRepository <ToDoTask>()) { var emailSubject = $"Remainder for your task:{item.Desc}"; var emailContent = $"This is remainder for your task:{item.Desc}"; var content = EmailBody.Replace("{TITLE}", item.LastName).Replace("{CONTENT}", emailContent); var result = emailSender.Send(item.Email, emailSubject, content); if (result) { var task = repo.SingleOrDefault(o => o.Id == item.Id); task.NotificationSent = true; task.NotificationSentDate = DateTime.Now; repo.SaveChanges(); } } }
private async Task <EmailBody> ReadMailTemplate(string html, string text) { EmailBody body; string path; body = new EmailBody(); path = this._env.GetTemplatePath(html); using (var reader = System.IO.File.OpenText(path)) { body.HtmlBody = await reader.ReadToEndAsync().AwaitBackground(); } path = this._env.GetTemplatePath(text); using (var reader = System.IO.File.OpenText(path)) { body.TextBody = await reader.ReadToEndAsync().AwaitBackground(); } return(body); }
public async Task <IResult <GenericResponse> > SendVerificationEmail(string kindOf, string to, string subject, bool isHtmlBody, string token, bool isForWebsite) { var body = ""; var successMsg = ""; var toList = new List <string> { to }; if (kindOf.Equals(ConstVariables.EmailVerificationBody)) { body = EmailBody.GetUserVerificationBody(to, _configModel.DHPEmail.Sender, token, isForWebsite == true ? _configModel.AppConfig.WebsiteUrl : _configModel.AppConfig.DashboardUrl); successMsg = $@"A verification email is sent to {to}. Please verify your email by following the instructions."; } else if (kindOf.Equals(ConstVariables.ResetPasswordEmailBody)) { body = EmailBody.GetForgotPasswordBody(_configModel.DHPEmail.Sender, token, isForWebsite == true ? _configModel.AppConfig.WebsiteUrl + "/account" : _configModel.AppConfig.DashboardUrl + "/auth"); successMsg = $@"A password reset token is sent to {to}. Please follow the instructions to reset your password."; } else if (kindOf.Equals(ConstVariables.NewAccountConformationBody)) { body = EmailBody.GetNewAccountConformationBody(_configModel.DHPEmail.Sender, token, _configModel.AppConfig.DashboardUrl, to); successMsg = $@"Account information is sent to {to}."; } // var response = await SendEmail(toList, subject, body, isHtmlBody, null, null); var response = await SendEmailSMTP(toList, subject, body, isHtmlBody, null, null); if (response == HttpStatusCode.OK) { return(Response <GenericResponse> .SuccessResponese(successMsg)); } else { if (kindOf.Equals(ConstVariables.NewAccountConformationBody)) { return(Response <GenericResponse> .ErrorResponse(@"Account has been created but failed to send email to the account holder.")); } return(Response <GenericResponse> .ErrorResponse(@"Problem Sending Email. Please resend the email.")); } }
public IHttpActionResult Registration(UserBaseAddRequest model) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } string token = ""; string email = model.Email; token = _userService.Create(model); EmailBody eb = new EmailBody { Token = token, TemplateType = EmailFileType.REGISTER }; //*************GMAIL INJECTION CODE TEST FOR SENDING ONE EMAIL TO A SINGLE EMAIL************* // Note: Service must include 'To', 'Subject', and 'Body'. 'Body' may include HTML _gmailService.SendSingleEmail(new GmailContent { To = new EmailUserObj { Email = email }, Subject = "Thank You For Registering", //Body = "Thank you for Registering with Prospect. Click Here to LogIn. http://localhost:3024/home/registerValidation/" + token Body = _emailTemplate.CreateEmailBody(eb) }); return(Ok(new ItemResponse <string> { Item = "success" })); } catch (Exception ex) { return(Ok(new ItemResponse <string> { Item = ex.Message })); } }
/// <summary> /// reset a password sends a password reset link to the given email /// </summary> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="appId">ID of app</param> /// <param name="body">request body</param> /// <returns>Task of ApiResponse (string)</returns> public async System.Threading.Tasks.Task<ApiResponse<string>> ResetPasswordAsyncWithHttpInfo (string appId, EmailBody body) { // verify the required parameter 'appId' is set if (appId == null) throw new ApiException(400, "Missing required parameter 'appId' when calling ResetPassword"); // verify the required parameter 'body' is set if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling ResetPassword"); var localVarPath = "user/{app_id}/resetPassword"; var localVarPathParams = new Dictionary<String, String>(); var localVarQueryParams = new Dictionary<String, String>(); var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary<String, String>(); var localVarFileParams = new Dictionary<String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); if (appId != null) localVarPathParams.Add("app_id", Configuration.ApiClient.ParameterToString(appId)); // path parameter if (body.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter } else { localVarPostBody = body; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; if (localVarStatusCode >= 400) throw new ApiException (localVarStatusCode, "Error calling ResetPassword: "******"Error calling ResetPassword: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); return new ApiResponse<string>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (string) Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); }
/// <summary> /// reset a password sends a password reset link to the given email /// </summary> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="appId">ID of app</param> /// <param name="body">request body</param> /// <returns>string</returns> public string ResetPassword (string appId, EmailBody body) { ApiResponse<string> localVarResponse = ResetPasswordWithHttpInfo(appId, body); return localVarResponse.Data; }
public void Init() { instance = new EmailBody(); }
/// <summary> /// reset a password sends a password reset link to the given email /// </summary> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="appId">ID of app</param> /// <param name="body">request body</param> /// <returns>Task of string</returns> public async System.Threading.Tasks.Task<string> ResetPasswordAsync (string appId, EmailBody body) { ApiResponse<string> localVarResponse = await ResetPasswordAsyncWithHttpInfo(appId, body); return localVarResponse.Data; }