public static Out EmailSent(EmailSent es, IState state) { var ws = state.Get <WorkflowState>().Value; Console.WriteLine("Email send success: {0}\nAddress: {1}\nContent: {2}", es.Successful, ws.EmailAddress, ws.EmailContent); return(Out.End); }
private void OnEmailSent(MimeMessage message, string response) { EmailSent?.Invoke(message, new EmailStateEventArgs(true, null) { ServerResponse = response }); }
protected void radGridTemplateHistory_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { EmailSent emailsent = (EmailSent)e.Item.DataItem; if (emailsent != null) { Jury jury = Jury.GetJury(emailsent.JuryId); if (jury != null) { Label lblType = (Label)e.Item.FindControl("lblType"); lblType.Text = jury.Type; LinkButton lnkBtnJuryId = (LinkButton)e.Item.FindControl("lnkBtnJuryId"); lnkBtnJuryId.Text = jury.SerialNo; lnkBtnJuryId.CommandArgument = jury.Id.ToString(); HyperLink lnk = (HyperLink)e.Item.FindControl("lnkJuryName"); lnk.Text = jury.FirstName + " " + jury.LastName; lnk.NavigateUrl = "mailto:" + jury.Email; } Label lblEmailTemplate = (Label)e.Item.FindControl("lblEmailTemplate"); lblEmailTemplate.Text = emailsent.TemplateName; } } }
protected virtual void OnEmailSent(Video video) { EmailSent?.Invoke(this, new VideoEventArgs() { Video = video }); }
public bool SendEmail(EmailTypes type, ITranslator translator) { if (translator == null) { throw new ArgumentNullException(nameof(translator)); } string emailContent = myEmailContentCreator.GetEmailContent(type); string translatedContent = translator.Translate(emailContent); if (myEmailSendingService.Send(translatedContent)) { EmailSent?.Invoke(this, EventArgs.Empty); return(true); } return(false); }
public bool SendEmail(EmailModel emailModel) { try { // we need to set LastUpdatedBy_ID for Currently Logged on Volunteer OR Admin var volunteer = _volunteerRepository.GetVolunteer(emailModel.CurrentUserEmail, emailModel.OrganisationId); var lastUpdatedBy = volunteer == null ? 0 : volunteer.Volunteer_ID; var mandrillKey = ConfigurationManager.AppSettings["Mandrill-Key"]; var mandrillUserName = ConfigurationManager.AppSettings["Mandrill-UserName"]; _mandrillEmailSender.SetMandrillEmailSender(mandrillUserName, mandrillKey); var messageStatus = _mandrillEmailSender.Send(emailModel.MandrillEmailMessage); Utilities.EmailMessageStatus emailStatus; //create email sent record foreach (var emailTo in messageStatus.messageResult) { emailStatus = GetEmailStatus(emailTo.status); var emailSent = new EmailSent { Email_VC = emailTo.email, Status_ID = (int)emailStatus, Date_DT = DateTime.Now, Entity_ID = emailModel.EntityId, EntityType_VC = emailModel.EntityType, Message_VC = emailModel.MandrillEmailMessage.html, Organisation_ID = emailModel.OrganisationId, Subject_VC = emailModel.MandrillEmailMessage.subject, Template_ID = emailModel.TemplateId, LastUpdatedBy_ID = lastUpdatedBy, CreateActivity = true, Token_VC = messageStatus.MessageSent ? emailTo._id : null }; _emailSentRepository.AddEmailSent(emailSent); } return(messageStatus.MessageSent); } catch (Exception ex) { return(false); } }
public string SendEmail(EmailSent emailSent) { try { MailMessage mail = new MailMessage(); if (!string.IsNullOrWhiteSpace(emailSent.ToAdress)) { mail.To.Add(new MailAddress(emailSent.ToAdress)); } else { return("Fel: epost saknas"); } SmtpClient smtp = new SmtpClient(); mail.Subject = emailSent.Subject; mail.Body = emailSent.Body; mail.From = new MailAddress("*****@*****.**"); smtp.Host = "email-smtp.eu-west-1.amazonaws.com"; smtp.Port = 587; smtp.Credentials = new NetworkCredential("AKIAJHWHSHKJSAU7HHKA", "ArgG45hZzmrrMV4OKUaFtkIVELD36l5MzchqShMWOI6l"); smtp.EnableSsl = emailSent.UseSSL; smtp.EnableSsl = true; mail.IsBodyHtml = true; smtp.Send(mail); Sent = true; return("Email skickat till " + emailSent.ToAdress); }catch (Exception e) { Sent = false; return("Kunde inte skicka email till" + emailSent.ToAdress + "Meddelande: " + e.Message); } }
public void SendNewQualityReportMail(QualityReport mailreport) { try { KvalPortDbEntities db = new KvalPortDbEntities(); QualityReport _report = db.QualityReports.Where(r => r.Id == mailreport.Id).FirstOrDefault(); if (_report != null) { ObservableCollection <QRStatusEmailNotification> SelectedOfficeQREmailNotifications = new ObservableCollection <QRStatusEmailNotification>(from qrEmail in db.QRStatusEmailNotifications where qrEmail.OfficeId == _report.OfficeId && qrEmail.StatusId == 1 select qrEmail); if (SelectedOfficeQREmailNotifications.Count > 0) { ObservableCollection <string> sentEmails = new ObservableCollection <string>(); EmailSent es; QRLog qrLog = new QRLog(); qrLog.Cost = 0; qrLog.Created = DateTime.Now; qrLog.CreatedBy = _report.CreatedBy;; qrLog.LogTypeId = 3; // (int)QRLogTypesEnum.Programåtgärd; qrLog.QualityReportId = _report.Id; qrLog.Deleted = false; qrLog.Subject = "Epost har skickats (rapport skapad)"; qrLog.Description = ""; StringBuilder descrp = new StringBuilder(); string EmailBody = CreatedQREmailNewReport(_report); foreach (QRStatusEmailNotification not in SelectedOfficeQREmailNotifications) { es = new EmailSent(); es.Automatic = true; es.Created = DateTime.Now; es.FromAdress = "*****@*****.**"; es.ModuleId = 1; es.OfficeId = _report.OfficeId; es.Password = "******"; es.Username = "******"; es.UseSSL = true; es.Port = 25; es.Server = "localhost"; es.Subject = "Kvalitetsrapport"; es.ToAdress = ""; es.SendMessage = "test"; es.Sent = false; if (not.IsEmployee) { if (not.Employee.Email == null || not.Employee.Email.Count() < 1) { descrp.AppendLine("Epost kunde inte skickas till användaren: " + not.Employee.FName + " " + not.Employee.LName + ". Orsak: Epost-adress saknades"); } else if (not.Employee.Email.Count() < 5) { descrp.AppendLine("Epost kunde inte skickas till användaren: " + not.Employee.FName + " " + not.Employee.LName + ". Orsak: Epost-adress felaktig"); } else { es.Body = EmailBody; descrp.AppendLine("Epost har skickats till : " + not.Employee.FName + " " + not.Employee.LName + " (" + not.Employee.Email + ")"); es.ToAdress = not.Employee.Email; if (sentEmails.Contains(es.ToAdress)) { es.Sent = true; } else { sentEmails.Add(es.ToAdress); es.SendMessage = SendEmail(es); } db.EmailSents.Add(es); } } else if (not.IsMailContact) { if (not.EmailContact.Email == null || not.EmailContact.Email.Count() < 1) { descrp.AppendLine("Epost kunde inte skickas till epost-kontakten: " + not.EmailContact.Name + ". Orsak: Epost-adress saknades"); } else if (not.EmailContact.Email.Count() < 5) { descrp.AppendLine("Epost kunde inte skickas till epost-kontakten: " + not.EmailContact.Name + ". Orsak: Epost-adress felaktig"); } else { es.Body = EmailBody; descrp.AppendLine("Epost har skickats till epost-kontkten: " + not.EmailContact.Email + " (" + not.EmailContact.Email + ")"); es.ToAdress = not.EmailContact.Email; if (sentEmails.Contains(es.ToAdress)) { es.Sent = true; } else { es.SendMessage = SendEmail(es); sentEmails.Add(es.ToAdress); } db.EmailSents.Add(es); } } else if (not.IsReportRole) { if (not.ReportRoll == "Responsible") { if (_report.QRResponsible.Employee.Email == null || _report.QRResponsible.Employee.Email.Count() < 1) { descrp.AppendLine("Epost kunde inte skickas till handläggaren: " + _report.QRResponsible.Employee.FName + " " + _report.QRResponsible.Employee.LName + ". Orsak: Epost-adress saknades"); } else if (_report.QRResponsible.Employee.Email.Count() < 5) { descrp.AppendLine("Epost kunde inte skickas till handläggaren: " + _report.QRResponsible.Employee.FName + " " + _report.QRResponsible.Employee.LName + ". Orsak: Epost-adress felaktig"); } else { es.Body = EmailBody; descrp.AppendLine("Epost har skickats till handläggaren: " + _report.QRResponsible.Employee.FName + " " + _report.QRResponsible.Employee.LName + " (" + _report.QRResponsible.Employee.Email + ")"); es.ToAdress = _report.QRResponsible.Employee.Email; if (sentEmails.Contains(es.ToAdress)) { es.Sent = true; } else { es.SendMessage = SendEmail(es); sentEmails.Add(es.ToAdress); } db.EmailSents.Add(es); } } else if (not.ReportRoll == "CausedBy") { if (_report.OfficeDepartment.Employee.Email == null || _report.OfficeDepartment.Employee.Email.Count() < 1) { descrp.AppendLine("Epost kunde inte skickas till avdelningsansvarig för orsakad av: " + _report.OfficeDepartment.Employee.FName + " " + _report.OfficeDepartment.Employee.LName + ". Orsak: Epost-adress saknades"); } else if (_report.OfficeDepartment.Employee.Email.Count() < 5) { descrp.AppendLine("Epost kunde inte skickas till avdelningsansvarig för orsakad av: " + _report.OfficeDepartment.Employee.FName + " " + _report.OfficeDepartment.Employee.LName + ". Orsak: Epost-adress felaktig"); } else { es.Body = EmailBody; descrp.AppendLine("Epost har skickats till avdelningsansvarig för orsakad av: " + _report.OfficeDepartment.Employee.FName + " " + _report.OfficeDepartment.Employee.LName); es.ToAdress = _report.OfficeDepartment.Employee.Email; if (sentEmails.Contains(es.ToAdress)) { es.Sent = true; } else { es.SendMessage = SendEmail(es); sentEmails.Add(es.ToAdress); } db.EmailSents.Add(es); } } else if (not.ReportRoll == "CreatedBy") { if (_report.Employee.Email == null || _report.Employee.Email.Count() < 1) { descrp.AppendLine("Epost kunde inte skickas till användaren som skapade ärendet: " + _report.Employee.FName + " " + _report.Employee.LName + ". Orsak: Epost-adress saknades"); } else if (_report.Employee.Email.Count() < 5) { descrp.AppendLine("Epost kunde inte skickas till användaren som skapade ärendet: " + _report.Employee.FName + " " + _report.Employee.LName + ". Orsak: Epost-adress felaktig"); } else { es.Body = EmailBody; descrp.AppendLine("Epost har skickats till användaren som skapade ärendet: " + _report.Employee.FName + " " + _report.Employee.LName + " (" + _report.Employee.Email + ")"); es.ToAdress = _report.Employee.Email; if (sentEmails.Contains(es.ToAdress)) { es.Sent = true; } else { es.SendMessage = SendEmail(es); sentEmails.Add(es.ToAdress); } db.EmailSents.Add(es); } } } } if (descrp.Length > 5) { qrLog.Description = descrp.ToString(); db.QRLogs.Add(qrLog); } db.SaveChanges(); } } } catch (Exception ex) { //IsLoading = false; // ErrorWindow.CreateNew("Kunde inte skapa och skicka email. Felmeddelande: " + ex.Message); } }
protected void Apply(EmailSent e) { }
public void Consume(EmailSent message) { _lastEmailSent = message.SentAt; Bus.Publish(new UserVerificationEmailSent(_correlationId)); }
private Task <StepResult <EmailRouteState> > emailWasSentLogic(StateAccess <EmailRouteState> access, EmailSent es) { Console.WriteLine("Hey! An email was sent: {0}", es); _tcs.SetResult(true); return(Task.Run(() => StepResult.Cancel <EmailRouteState>())); }
public DIContainer() { RelocationInfo = new RelocateInfoImg(); EmailSent = new EmailSent(); }