/// <summary> /// /// </summary> /// <param name="userRegistrationInfo"></param> /// <param name="userId"></param> /// <returns></returns> public IEmailDetail CreateUserRegistrationRequestEmail(IUsersView userRegistrationInfo, int userId) { if (userRegistrationInfo == null) { throw new ArgumentNullException(nameof(userRegistrationInfo)); } var token = string.Format("xyz"); var theSubject = "Confirm your AA.HRMS Registration Request"; var recipient = userRegistrationInfo.Email; var theBody = "You are now registered for AA HRMS services."; theBody = string.Format("{0} {1}", theBody, "<br><br> Your username is your email."); theBody = string.Format("{0} {1}{2}", theBody, "<br><br> Your confirmation token is ", token); theBody = string.Format("{0} {1}", theBody, "<br><br> <a href='www.automataassociates.com'>AA.HRMS</a>"); theBody = string.Format("{0} {1}", theBody, "<br><br> Thank you"); var mailDetail = new EmailDetail { Body = theBody, Recipients = recipient, Subject = theSubject }; return(mailDetail); }
/// <summary> /// /// </summary> /// <param name="registrationInfo"></param> /// <param name="registrationId"></param> /// <returns></returns> public IEmailDetail CreateRegistrationRequestEmail(IRegistrationView registrationInfo, int registrationId, string activationCode) { if (registrationInfo == null) { throw new ArgumentNullException(nameof(registrationInfo)); } var theSubject = "Welcome to AA HRMS"; var recipient = registrationInfo.Email; var theBody = "Your registration was successful, we look forward to facilitate the growth and management of your Company."; theBody = string.Format("{0} {1}", theBody, "<br><br> Your username is your email or username"); theBody = string.Format("{0} {1}", theBody, "<br><br>Please click the link below to activate you account "); theBody = string.Format("{0} {1} {2} {3}", theBody, "<br><br> <a class='btn sm-btn' href='localhost:5200/Account/Activate?activationCode=", activationCode, "'>Click Here</a>"); theBody = string.Format("{0} {1}", theBody, "<br><br> Thank you"); var mailDetail = new EmailDetail { Body = theBody, Recipients = recipient, Subject = theSubject }; return(mailDetail); }
/// <summary> /// Creates the forget password email. /// </summary> /// <param name="activationCode">The activation code.</param> /// <param name="email">The email.</param> /// <returns></returns> public IEmailDetail CreateForgetPasswordEmail(string activationCode, string email) { string domainName = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority); var url = string.Format("{0}", "<a href=" + domainName + "/Account/ConfirmPassword?code=" + activationCode + ">Change Password <a/>"); var subject = "Change Password"; var recipients = email; var body = string.Format("{0} {1} {2}", "<p>Dear Customer,</p> <p> We have received a request to change your password. Please click on the link provided to change your password </p> <p>", url, "</p><p>Please ignore this mail if you have not made this request</p>" + "<p>Pitalytics Team</p>"); var emailDetail = new EmailDetail { Body = body, Recipients = recipients, Subject = subject }; return(emailDetail); }
private async Task SendUserContact(ContactNotification model) { var htmlContent = await base._viewRenderer.RenderViewToString("Views/Admin/ContactFromUser.cshtml", new ContactFromUserViewModel() { CompanyName = model.CompanyName, CostumerEmail = model.CostumerEmail, CostumerName = model.CostumerName, Message = model.Message, Subject = model.Subject }); var plainTextContent = base._plainTextContentRenderer.RenderModelToString(new { Nome = model.CostumerName, Email = model.CostumerEmail, Assunto = model.Subject, Memsagem = model.Message, }); var emailDetail = new EmailDetail() { ToEmail = model.CompanyEmail, ToName = model.CompanyName, Subject = $"[Contact From {model.CompanyName} Site: {model.Subject}]", PlainTextContent = plainTextContent, HtmlContent = htmlContent, FromEmail = model.CostumerEmail, FromName = model.CostumerName, }; await base._emailService.SendEmail(emailDetail); }
private async Task SendResetPaswordAsync(string customerName, string customerEmail, string resetLink, string companyName, string companyEmail) { ResetPasswordViewModel model = new ResetPasswordViewModel(); model.CustomerName = customerName; model.ResetLink = resetLink; var htmlContent = await base._viewRenderer.RenderViewToString("Views/Identity/ResetPassword.cshtml", model); var plainTextContent = base._plainTextContentRenderer.RenderModelToString(new { Memsagem = $"Olá {customerName}! Entre no link e escolha uma nova senha", Link = resetLink }); var emailDetail = new EmailDetail() { ToEmail = customerEmail, ToName = customerName, Subject = "Mude sua senha", PlainTextContent = plainTextContent, HtmlContent = htmlContent, FromEmail = companyEmail, FromName = companyName, }; await base._emailService.SendEmail(emailDetail); }
/// <summary> /// Creates the send email to admin. /// </summary> /// <param name="orderNumber">The order number.</param> /// <param name="orderTitle">The order title.</param> /// <param name="firstName">The first name.</param> /// <param name="userEmail">The user email.</param> /// <param name="type"></param> /// <returns></returns> public IEmailDetail CreateSendEmailToAdmin(string orderNumber, string orderTitle, string firstName, string userEmail, string type) { if (type == "Order") { var AdminSubject = "New Order Alert"; var AdminRecipient = userEmail; var AdminBody = string.Format("<p>Dear Admin</p>"); AdminBody = string.Format("{0} {1}", AdminBody, "<p>A new Order with Order Number : " + orderNumber); AdminBody = string.Format("{0}{1}", AdminBody, " has just been completed and paid</p>"); var emailDetails = new EmailDetail { Body = AdminBody, Recipients = AdminRecipient, Subject = AdminSubject }; return(emailDetails); } var Subject = "Review"; var recipients = userEmail; var Body = string.Format("{0}", "Dear " + firstName); Body = string.Format("{0} {1}", Body, "The order with " + orderNumber); Body = string.Format("{0}{1}", Body, " has been reviewed"); var emailDetail = new EmailDetail { Body = Body, Recipients = recipients, Subject = Subject }; return(emailDetail); }
private async Task SendBoleto(string customerName, string customerEmail, string boletoUrl, string companyName, string companyEmail) { PaymentBoletoViewModel model = new PaymentBoletoViewModel(); model.BoletoLink = boletoUrl; model.CustomerName = customerName; var htmlContent = await base._viewRenderer.RenderViewToString("Views/Payment/PaymentBoleto.cshtml", model); var plainTextContent = base._plainTextContentRenderer.RenderModelToString(new { Memsagem = $"Olá {customerName}! Seu boleto foi gerado, entre no link para obte-lo", BoletoLink = boletoUrl }); var emailDetail = new EmailDetail() { ToEmail = customerEmail, ToName = customerName, Subject = "Boleto para pagamento", PlainTextContent = plainTextContent, HtmlContent = htmlContent, FromEmail = companyEmail, FromName = companyName }; await base._emailService.SendEmail(emailDetail); }
private async Task SendConfirmedPayment(string customerName, string customerEmail, string companyName, string companyEmail) { PaymentConfirmedViewModel model = new PaymentConfirmedViewModel(); model.CustomerName = customerName; var htmlContent = await base._viewRenderer.RenderViewToString("Views/Payment/PaymentConfirmed.cshtml", model); var plainTextContent = base._plainTextContentRenderer.RenderModelToString(new { Memsagem = $"Olá {customerName}! Seu pagamento foi confirmado", }); var emailDetail = new EmailDetail() { ToEmail = customerEmail, ToName = customerName, Subject = "Pagamento aprovado", PlainTextContent = plainTextContent, HtmlContent = htmlContent, FromEmail = companyEmail, FromName = companyName }; await base._emailService.SendEmail(emailDetail); }
/// <summary> /// Creates the notification email. /// </summary> /// <param name="registrationInfo">The registration information.</param> /// <param name="registrationId">The registration identifier.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">registrationInfo</exception> public IEmailDetail CreateNotificationEmail(IUserView registrationInfo, int registrationId) { if (registrationInfo == null) { throw new ArgumentNullException(nameof(registrationInfo)); } // var token = string.Format("{0},{1},{2}", registrationInfo.FirstName.First(), registrationId, registrationInfo.LastName.Last()); var theSubject = "Confirm your Pitalytics Registration Request"; var recipient = registrationInfo.Email; var theBody = "You are now registered for Pitalytics services."; theBody = string.Format("{0} {1}{2}", theBody, "<br><br> Hello, .", registrationInfo.FirstName); theBody = string.Format("{0} {1}", theBody, "<br><br> You have a new Notification From ADit Scripting Service"); theBody = string.Format("{0} {1}", theBody, "<br><br> Click on the link below to login and view your message"); theBody = string.Format("{0} {1}", theBody, "<br><br> <a href='www.automataassociates.com'>ADit Login</a>"); theBody = string.Format("{0} {1}", theBody, "<br><br> Thank you"); var mailDetail = new EmailDetail { Body = theBody, Recipients = recipient, Subject = theSubject }; return(mailDetail); }
private async Task SendReceivedOrder(string customerName, string customerEmail, long amountInCents, string companyName, string companyEmail) { ReceivedOrderViewModel model = new ReceivedOrderViewModel(); model.CustomerName = customerName; model.AmountInCents = amountInCents; var htmlContent = await base._viewRenderer.RenderViewToString("Views/Payment/ReceivedOrder.cshtml", model); var plainTextContent = base._plainTextContentRenderer.RenderModelToString(new { Memsagem = $"Olá {customerName}! Recebemos seu pedido", }); var emailDetail = new EmailDetail() { ToEmail = customerEmail, ToName = customerName, Subject = "Pedido recebido", PlainTextContent = plainTextContent, HtmlContent = htmlContent, FromEmail = companyEmail, FromName = companyName }; await base._emailService.SendEmail(emailDetail); }
private async Task SendConfirmEmailAsync(string customerName, string customerEmail , string confirmLink, string companyContactLink, string companyName, string companyEmail) { ConfirmEmailViewModel model = new ConfirmEmailViewModel(); model.CustomerName = customerName; model.ConfirmLink = confirmLink; model.CompanyContactLink = companyContactLink; model.CompanyName = companyName; var htmlContent = await base._viewRenderer.RenderViewToString("Views/Identity/ConfirmEmail.cshtml", model); var plainTextContent = base._plainTextContentRenderer.RenderModelToString(new { Memsagem = $"Olá {customerName}! Criamos uma conta para você. Confirme o seu email e escolha uma nova senha", Link = confirmLink }); var emailDetail = new EmailDetail() { ToEmail = customerEmail, ToName = customerName, Subject = "Confirme seu email", PlainTextContent = plainTextContent, HtmlContent = htmlContent, FromEmail = companyEmail, FromName = companyName, }; await this._emailService.SendEmail(emailDetail); }
private void UpdateMailFromBox(string box, DateTime lastSyncDate) { Mailbox inbox = _imap4Client.SelectMailbox(box); string strDate = lastSyncDate.ToString("dd-MMM-yyyy", CultureInfo.InvariantCulture); ActiveUp.Net.Mail.Message mail = null; int[] ids = inbox.Search("SENTSINCE " + strDate); if (ids.Length > 0) { TimeFilter timeFilter = new TimeFilter(); timeFilter.SetRule(lastSyncDate); this.AppendFilter(timeFilter); for (int l = ids.Length - 1; l >= 0; l--) { mail = inbox.Fetch.MessageObject(ids[l]); if (IsCorrectMail(mail)) { EmailDetail email = new EmailDetail(ids[l], ConvertUniversalTime(mail), mail.Subject, mail.From.Email, box); email.AttachNames.AddRange(GetAttachmentFileNameFromMail(_savePath, mail)); emailDetailList.Add(email); GetAttachmentFromMail(_savePath, mail); } } } }
/// <summary> /// Creates the registration request email. /// </summary> /// <param name="registrationInfo">The registration information.</param> /// <param name="registrationId">The registration identifier.</param> /// <returns></returns> /// <exception cref="NotImplementedException"></exception> public IEmailDetail CreateRegistrationRequestEmail(string email, string firstName, string activationCode) { string domainName = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority); var url = string.Format("{0}", "<a href=" + domainName + "/Account/ActivationCode?code=" + activationCode + ">Activate Account <a/>"); var theSubject = "Pitalytics Account Confirmation"; var recipient = email; var theBody = "<p>Dear " + firstName + ",</p>"; theBody = string.Format("{0} {1}", theBody, "Welcome to ADit. Please click on the confirmation link below to activate your account"); theBody = string.Format("{0} {1}{2}", theBody, "<p> Your confirmation link is ", url); theBody = string.Format("{0} {1}", theBody, "</p> Thank you</p>"); var mailDetail = new EmailDetail { Body = theBody, Recipients = recipient, Subject = theSubject }; return(mailDetail); }
public ActionResult Register(RegistrationFormViewModel vm) { if (!ModelState.IsValid) { return(CurrentUmbracoPage()); } var member = Members.CreateRegistrationModel(); member.Name = vm.Name; member.Email = vm.Email; member.Password = vm.Password; member.UsernameIsEmail = true; MembershipCreateStatus status; Members.RegisterMember(member, out status); if (!status.Equals(MembershipCreateStatus.Success)) { return(CurrentUmbracoPage()); } var email = new EmailDetail { To = new List <string> { member.Email }, Subject = "Registraion confirmation", IsBodyHtml = false }; _mailer.Send(email); return(RedirectToCurrentUmbracoPage()); }
public static void CreateEventMailNotification(int eventId, long parentId, string subjectParams, string body) { var emailData = DataAccess.Event.EventCommands.GetEventEmailDetail(eventId, parentId); if (emailData != null) { EmailDetail emailDetail = new EmailDetail() { FromAddress = emailData.FromMail, Body = string.IsNullOrEmpty(body) ? emailData.Body : body, CCAddress = emailData.CcAddress, EmailPriority = 1, IsBodyHtml = true, Subject = string.Format(emailData.Subject, subjectParams), ToAddress = emailData.ToAddress }; if (emailDetail != null && !string.IsNullOrEmpty(emailDetail.ToAddress)) { DataAccess.Common.EmailCommands.InsertEmailDetail(emailDetail); } else { DataAccess.Logger.ErrorLogger.Log(new Exception(), "To Email address can not be empty to sent event Notification.", "CreateEventMailNotification", Utilities.Logger.LogType.Informational); } } }
/// <summary> /// /// </summary> /// <param name="registrationInfo"></param> /// <param name="registrationId"></param> /// <returns></returns> public IEmailDetail CreateRegistrationConfirmationEmail(IRegistrationView registrationInfo, int registrationId) { var mailDetail = new EmailDetail { Body = "Your registration is confirmed", Recipients = registrationInfo.Email, Subject = "Stop bordering us" }; return(mailDetail); }
public static EmailDetail GetDetail(long pos) { EmailDetail emailDetail = new EmailDetail(); pop3Client.NextEmail(pos); emailDetail.From = pop3Client.From; emailDetail.To = pop3Client.To; emailDetail.Subject = pop3Client.Subject; emailDetail.Subject = pop3Client.Body; return(emailDetail); }
public void Post(string token, [FromBody] string emailData) { SmtpClient smtp = new SmtpClient(); MailMessage mm; try { if (emailData.Length > 0) { //Deserialzing Email Objects EmailDetail email = JsonConvert.DeserializeObject <EmailDetail>(emailData.ToString()); smtp.UseDefaultCredentials = false; smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.Credentials = new NetworkCredential("noreply", "44bananas55$"); smtp.Host = "connect.orgsoln.com"; //Change for smtp from OSI smtp.EnableSsl = false; smtp.Port = 25; mm = new MailMessage("*****@*****.**", email.emailData.To); mm.Subject = email.emailData.Subject; mm.IsBodyHtml = true; mm.Body = email.emailData.Body; if (email.emailData.AttachmentPaths != null) { foreach (var path in email.emailData.AttachmentPaths) { mm.Attachments.Add(new Attachment(path)); } } smtp.Send(mm); smtp.Dispose(); } } catch (Exception ex) { EmailDetail email = JsonConvert.DeserializeObject <EmailDetail>(emailData.ToString()); if (token != null) { InsertEmail(Convert.ToInt32(context.GetUserIDSession(token)), Convert.ToInt32(context.GetClientIDBySession(token)), email.emailData.ClaimID, email.emailData.From, email.emailData.To, email.emailData.Subject, email.emailData.Body, 1); } else { InsertEmail(0, 0, 0, email.emailData.From, email.emailData.To, email.emailData.Subject, email.emailData.Body, 1); } ExceptionLog.LogException(ex); } }
/// <summary> /// Creates the customer message. /// </summary> /// <param name="receipientEmail">The receipient email.</param> /// <param name="subject">The subject.</param> /// <param name="message">The message.</param> /// <returns></returns> public IEmailDetail CreateCustomerMessage(string receipientEmail, string subject, string message) { message = "<p>Dear Customer, we have receieved your message.</p> <p>Be rest assured that we are working on your request and we will get back to you as soon as possible</p> <p>Thanks</p> "; var email = new EmailDetail { Body = message, Recipients = receipientEmail, Subject = subject }; return(email); }
public void RemoveEmail(int emailID) { EmailDetail email = _db.EmailDetails.FirstOrDefault(a => a.Mail_ID == emailID); if (email != null) { _db.EmailDetails.Remove(email); _db.SaveChanges(); } else { throw new Exception("EmailID doesnt exist"); } }
public IEmailDetail CreatePickOrderEmail(int orderFulfilmentId, string customerEmail) { var message = $"<p>Dear Customer,</p> <p>Your order {orderFulfilmentId} is now assigned for fulfilment.</p> <p>Thank you</p>"; var subject = "Order is now Assigned for Fulfilment"; var email = new EmailDetail { Body = message, Recipients = customerEmail, Subject = subject }; return(email); }
/// <summary> public IEmailDetail SendMail(string Name, string Email) { var Subject = "Processing Order"; var Recipient = Email; // var Body = string.Format("<p>Dear {0} </p>", Name); var Body = string.Format("Dear " + Name + " Your Order is been processed and reviewed"); var emailDetails = new EmailDetail { Body = Body, Recipients = Recipient, Subject = Subject }; return(emailDetails); }
public async Task SendEmail(EmailDetail emailDetail) { var apiKey = _configuration["Notification:Sendgrid:ApiKey"]; var client = new SendGridClient(apiKey); var from = new EmailAddress(emailDetail.FromEmail, emailDetail.FromName); var to = new EmailAddress(emailDetail.ToEmail, emailDetail.ToName); if (String.IsNullOrWhiteSpace(emailDetail.HtmlContent)) { emailDetail.HtmlContent = $"<p>{emailDetail.PlainTextContent}</p>"; } var msg = MailHelper.CreateSingleEmail(from, to, emailDetail.Subject, emailDetail.PlainTextContent, emailDetail.HtmlContent); var response = await client.SendEmailAsync(msg); }
private void btn7_Click(object sender, EventArgs e) { EMSContext _db = new EMSContext(); EmailDetail ed = new EmailDetail(); Student std = new Student(); User use = new User(); ed.Email = txt6.Text; ed.Password = txt7.Text; //ed.StudentID = Convert.ToInt32(std.StudentID); //ed.StudentUserID = Convert.ToInt32(use.UserID); _db.EmailDetails.Add(ed); _db.SaveChanges(); this.Close(); }
public Transform MyGridT; //邮件列表布局 protected void Awake() { mTrans = this.transform; mObj = this.gameObject; //初始化时隐藏详情界面 emailDetail = mTrans.Find ("PanelDetail").GetComponent<EmailDetail> (); if(emailDetail == null) emailDetail = mTrans.Find ("PanelDetail").gameObject.AddComponent<EmailDetail> (); emailDetail.Init (); if (backBtn == null) backBtn = mTrans.Find ("").GetComponent<Button> (); // if (EmailsItem == null) // EmailsItem = Resources.Load<>(path); if (MyGridT == null) MyGridT = mTrans.Find(""); }
private int ManagerEmails(EmailDetail detail) { int successCount = 0;; var info = new EmailInfo { Ename = detail.Sender, Etime = detail.ReceiveTime }; var reportManager = new ReportManager(); foreach (var t in detail.AttachNames) { info.CurrentAttrName = t; if (reportManager.InsertReportToService(info, strInfo)) { //attFetcher.DeleteEmailByID(detail.ID, detail.BelongMailBox); successCount++; } } return(successCount); }
public ActionResult AjaxSendEmail(ContactFormViewModel vm) { if (!ModelState.IsValid) { return(PartialView("_ContactForm", vm)); } var email = new EmailDetail { From = vm.Email, DisplayName = vm.FullName, Subject = vm.Subject, Body = vm.Message, IsBodyHtml = false }; _mailer.Send(email); return(Content(string.Format("<div class=\"alert alert-success\" role=\"alert\">{0}</div>", vm.ThankYouText), "text/html")); }
public static bool SetEmailDetails(ApplicationDbContext context) { try { if (!context.EmailDetails.Any()) { var email = new EmailDetail(); email.Port = 587; email.Host = "smtp.gmail.com"; email.UserName = "******"; email.Password = "******"; context.EmailDetails.Add(email); context.SaveChanges(); } return(true); } catch (Exception ex) { return(false); } }
public async Task <OperationStatus> SendMessageToAddress(string message, string address) { var apiKey = _config["Keys:sendgrid"]; var conn = new SendGrid.Connections.ApiKeyConnection(apiKey); var client = new SendGrid.SendGridClient(conn); var email = new Email(); var content = new Content(); content.Type = "text/html"; content.Value = message; var fromPers = new Personalization(); var toDetail = new EmailDetail { Email = address }; var fromDetail = new EmailDetail { Email = "*****@*****.**" }; fromPers.Subject = "Account activation"; fromPers.To = new List <EmailDetail> { toDetail }; email.Personalizations = new List <Personalization> { fromPers }; email.From = fromDetail; email.Content = new List <Content> { content }; await client.MailClient.SendAsync(email); return(new OperationStatus()); }
/// <summary> /// Creates the send contact us mail. /// </summary> /// <param name="contactEmail">The contact email.</param> /// <param name="userEmail">The user email.</param> /// <param name="name">The name.</param> /// <param name="phoneNumber">The phone number.</param> /// <param name="message">The message.</param> /// <returns></returns> public IEmailDetail CreateSendContactUsMail(string contactEmail, string userEmail, string name, string phoneNumber, string message) { var theSubject = "New Contact Message"; var recipient = contactEmail; var theBody = string.Empty; theBody = string.Format("{0} {1} ", theBody, "<p><b>Name</b> " + name + "</p>"); theBody = string.Format("{0} {1}", theBody, "<p> <b>Mobile</b> " + phoneNumber + "</p>"); theBody = string.Format("{0}{1}", theBody, "<p><b>Email</b> " + userEmail + "</p>"); theBody = string.Format("{0}{1}", theBody, "<p><b>Message</b><br/> " + message + "</p>"); var email = new EmailDetail { Body = theBody, Recipients = recipient, Subject = theSubject }; return(email); }
public async Task <IActionResult> PostAsync(AlertNotification request) { var model = new AlertNotificationViewModel() { AffectedSystem = request.AffectedSystem, ErrorDetail = request.ErrorDetail, OccurrenceDateTime = request.OccurrenceDateTime, TicketLink = request.TicketLink }; var plainTextContent = base._plainTextContentRenderer.RenderModelToString(new { Sistema = model.AffectedSystem, Data = model.OccurrenceDateTime.Date, Hora = $"{model.OccurrenceDateTime.Hour}:{model.OccurrenceDateTime.Minute}:{model.OccurrenceDateTime.Second}.", Detalhes = model.ErrorDetail, Ticket = model.TicketLink, }); foreach (var keeper in request.Keepers) { model.KeeperName = keeper.Name; var htmlContent = await base._viewRenderer.RenderViewToString("Views/Admin/Alert.cshtml", model); var emailDetail = new EmailDetail() { ToEmail = keeper.Email, ToName = keeper.Name, Subject = $"[Alert From System {request.AffectedSystem}]", PlainTextContent = plainTextContent, HtmlContent = htmlContent, FromEmail = request.CompanyEmail, FromName = request.CompanyName, }; await base._emailService.SendEmail(emailDetail); } return(Ok()); }