private bool SendPasswordRecoveryEmail(DbUser user) { string token = CreateUserToken(user); var confirmationLink = Url.Action(nameof(EditPassword), "Auth", new { token, id = user.UserId }, Request.Scheme); return(EmailProfile.SendEmail(user.Email, confirmationLink, "ToDoApp - Change your password")); }
private bool SendConfirmationEmail(DbUser user) { string token = CreateUserToken(user); var confirmationLink = Url.Action(nameof(ConfirmEmail), "Auth", new { token, email = user.Email }, Request.Scheme); return(EmailProfile.SendEmail(user.Email, confirmationLink, "ToDoApp - Confirm your email")); }
public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("ParseEmail function Started"); try { string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); AdviserCRM data = JsonConvert.DeserializeObject <AdviserCRM>(requestBody); EmailProfile profile = new EmailProfile(); Email email = GetEmail(data.agency._fdl_primaryemail_label, data); if (!string.IsNullOrEmpty(email.EmailAddress)) { profile.Email = email; } Email alternativeEmail = GetEmail(data.agency._fdl_alternateemail_label, data); if (!string.IsNullOrEmpty(alternativeEmail.EmailAddress)) { profile.AlternativeEmail = alternativeEmail; } return((ActionResult) new OkObjectResult(profile)); } catch (Exception ex) { return(new BadRequestObjectResult(String.Format("An error occurred processing this request. See detailes below\r\n{0}", ex.Message))); } }
public response SendVerificationCode(EmailProfile ep, string _to, string _code) { Emailing e = new Emailing(ep); e.Message.From = new MailAddress(ep.IncomingUser); //e.Message.Bcc.Add(new MailAddress(ep.IncomingUser)); // daca vrem sa se trimita mesajul si la noi e.Message.To.Add(_to); e.Message.Subject = String.Format("Cod acces www.compensaredirecta.ro: {0}", _code); e.Message.IsBodyHtml = true; //e.Message.Body = String.Format("Acesta este un mesaj generat automat.<br /><br />Puteti descarca documentele asociate dosarului facand click <a ses:notrack href=\"{2}\">aici</a>.<br /><br />Detalii suplimentare puteti gasi accesand linkul: <a ses:notrack href=\"{0}\">{1}</a>.<br /><br />Atasat va transmitem Cererea de despagubire.<br /><br /><br />Cu stima,<br />Echipa compensaredirecta.ro<br /><br />Va rugam sa nu raspundeti la acest email. Daca doriti sa ne contactati, scrieti-ne la [email protected].", linkDosar, this.NR_DOSAR_CASCO, linkDocumentePdf); string templateHtmlText = System.IO.File.ReadAllText(System.IO.Path.Combine(CommonFunctions.GetSettingsFolder(), "template_email_cod_acces.html")); double exp = Convert.ToDouble(ConfigurationManager.AppSettings["VerificationCodeExpiration"]); int minute = (int)(exp / 60); int secunde = (int)(exp % 60); string expiration = (minute > 0 ? minute.ToString() + " minute" : ""); expiration += (minute > 0 && secunde > 0 ? " si " : ""); expiration += (secunde > 0 ? secunde.ToString() + " secunde" : ""); templateHtmlText = templateHtmlText.Replace("{{CODE}}", _code) .Replace("{{EXPIRATION}}", expiration); e.Message.Body = templateHtmlText; response toReturn = e.SendVerificationCodeMessage(_code); return(toReturn); }
private void CreateEmailProfile(string name) { var emailProfile = EmailProfile.SingleOrDefault(p => p.Name == name) ?? new EmailProfile(); emailProfile.Name = name; emailProfile.Deleted = false; emailProfile.Save(); }
private void CreateEmailProfile(string name) { var emailProfile = EmailProfile.SingleOrDefault(p => p.Name == name) ?? new EmailProfile(); emailProfile.Name = name; emailProfile.Deleted = false; //TODO: Finish configuring the profile emailProfile.Save(); }
private EmailProfile GetDefaultEmailProfile() { var emailProfile = EmailProfile.SingleOrDefault(o => o.Name == "Default"); if (emailProfile == null) { throw new ArgumentOutOfRangeException("emailProfile", "The Default email profile could not be found. Have you run the installer?"); } return(emailProfile); }
//public IEmailService emailService { get; } public PipelineExecutionResult Execute(PurchaseOrder subject) { if (subject.OrderTotal.GetValueOrDefault() > 500) { EmailProfile emailProfile = catalogContext.CurrentCatalogGroup.EmailProfile; IDictionary <string, string> templateParameters = new Dictionary <string, string>(); templateParameters.Add("ordereValue", subject.OrderTotal.GetValueOrDefault().ToString()); emailService.Send(localizationContext, emailProfile, "vip", new MailAddress("*****@*****.**"), templateParameters); } return(PipelineExecutionResult.Success); }
// Email profiles private void BuildEmailProfiles() { var emailProfiles = EmailProfile.Find(x => !x.Deleted).ToList(); foreach (var profile in emailProfiles) { var id = profile.SitecoreId(); var item = new SystemItem(id, profile.Name); item.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/mails.png"); _emailProfiles.AddItem(item); } _emailProfiles.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/mail-open-table.png"); _emailProfiles.SetRevision(Guid.NewGuid()); }
private void UpdateStoreEmailProfile(string value, ProductCatalogGroup store) { ID id; if (ID.TryParse(value, out id)) { var emailProfile = EmailProfile.SingleOrDefault(x => x.Guid == id.Guid); if (emailProfile == null) { _loggingService.Log <ProductCatalogGroupTemplateBuilder>( string.Format("Failed to update email profile for store. Could not find email profile with guid: {0}.", id.Guid)); return; } store.EmailProfile = emailProfile; } else { _loggingService.Log <ProductCatalogGroupTemplateBuilder>( string.Format("Failed to update email profile for store. Could not find Sitecore ID for email profile with id: {0}.", value)); } }
private void CreateEmailProfile(string name, string type) { var languages = ObjectFactory.Instance.Resolve <ILanguageService>().GetAllLanguages(); var orderConfirmationType = EmailType.FirstOrDefault(x => x.Name == type); var emailProfile = EmailProfile.SingleOrDefault(p => p.Name == name) ?? new EmailProfile(); emailProfile.Name = name; emailProfile.Deleted = false; foreach (var language in languages) { var emailContent = emailProfile.EmailContents.SingleOrDefault(x => x.CultureCode == language.CultureCode && x.EmailType.Name == type) ?? new EmailContent(); emailContent.ContentId = "0d0c0ed6-7144-4a9a-a7d1-3284c8d459d1"; emailContent.CultureCode = language.CultureCode; emailContent.EmailProfile = emailProfile; emailContent.EmailType = orderConfirmationType; emailContent.Subject = "OrderConfirmation email"; emailContent.Save(); } emailProfile.Save(); }
public ProductCatalogGroup CatalogGroup(string name, string description, Currency defaultCurrency) { ProductCatalogGroup catalogGroup = _catalogGroups.Value.SingleOrDefault(x => x.Name == name); if (catalogGroup == null) { EmailProfile defaultEmailProfile = _emailProfiles.Value.Select(x => x.Name == "Default" && !x.Deleted).First(); var defaultOrderNumbers = _orderNumbers.Value.Select(x => x.OrderNumberName == "Default" && !x.Deleted).First(); catalogGroup = new ProductCatalogGroup { EmailProfile = defaultEmailProfile, OrderNumberSerie = defaultOrderNumbers }; } catalogGroup.Name = name; catalogGroup.Currency = defaultCurrency; catalogGroup.Description = description; catalogGroup.MemberGroupId = "-1"; catalogGroup.MemberTypeId = "-1"; catalogGroup.Deleted = false; return(catalogGroup); }
private void sendCustomerWelcomeEmail(string email, string password, int customerId, string memberId, string orderNumber, string orderGuid, string cultureCode, EmailProfile emailProfile) { var queryStringParameters = new Dictionary <string, string> { { "customerId", customerId.ToString() }, { "memberId", memberId }, { "orderNumber", orderNumber }, { "orderGuid", orderGuid }, { "User.Username", email }, { "User.Password", password } }; try { var customGlobalization = new CustomGlobalization(_commerceConfiguration); customGlobalization.SetCulture(new CultureInfo(String.IsNullOrWhiteSpace(cultureCode) ? customGlobalization.DefaultCulture.ToString() : cultureCode)); _emailService.Send(customGlobalization, emailProfile, _emailTypeName, new MailAddress(email), queryStringParameters); } catch (SmtpException exception) { _loggingService.Log <CreateMemberForCustomerTask>(exception); } }
// Email profiles public static ID SitecoreId(this EmailProfile @this) { return(new ID(@this.Guid)); }