public EmailLogDetailModel(EmailLog emailLog) : this() { Id = emailLog.Id; Priority = emailLog.Priority; From = emailLog.From; FromName = emailLog.FromName; To = emailLog.To; ToName = emailLog.ToName; if (!string.IsNullOrEmpty(emailLog.CC)) { CcList = emailLog.CC.Split(';').ToList(); } if (!string.IsNullOrEmpty(emailLog.Bcc)) { BccList = emailLog.Bcc.Split(';').ToList(); } Subject = emailLog.Subject; SentTries = emailLog.SentTries; SentOn = emailLog.SentOn; Body = emailLog.Body; EmailAccountId = emailLog.EmailAccountId; if (!string.IsNullOrEmpty(emailLog.Message)) { Logs = SerializeUtilities.Deserialize <List <EmailSendingLog> >(emailLog.Message); } RecordOrder = emailLog.RecordOrder; Created = emailLog.Created; CreatedBy = emailLog.CreatedBy; LastUpdate = emailLog.LastUpdate; LastUpdateBy = emailLog.LastUpdateBy; }
protected void Page_Load(object sender, EventArgs e) { int CurrentPageIndex = 0; if (!int.TryParse(hfCurrentPageIndex_dgLogs.Value, out CurrentPageIndex)) { CurrentPageIndex = 0; } if (CurrentPageIndex < 0) { CurrentPageIndex = 0; } dgLogs.CurrentPageIndex = CurrentPageIndex; action = Request.QueryString[@"action"]; if (action == @"preview") { Int64 EmailLogId = 0; Int64.TryParse(Request.QueryString[@"EmailLogId"], out EmailLogId); EmailLog logItem = EmailLogController.GetLogItem(EmailLogId); if (logItem != null) { Response.Clear(); Response.Write(logItem.Body); Response.End(); return; } } LoadItems(); }
private void Get_ParameterList() { string strSql = ""; EmailLog bllEmail = new EmailLog(); int Counts = this.NetPagerParameter.RecordCount; strSql += "EmailLog.EmailShopID = SysShop.ShopID and EmailLog.EmailUserID = SysUser.UserID "; strSql = PubFunction.GetShopAuthority(this._UserShopID, "EmailShopID", strSql); DataTable dt = bllEmail.GetListSP(this.NetPagerParameter.PageSize, this.NetPagerParameter.CurrentPageIndex, out Counts, new string[] { strSql }).Tables[0]; this.NetPagerParameter.RecordCount = Counts; this.NetPagerParameter.CustomInfoHTML = string.Format("<div class=\"results\"><span>当前第{0}/{1}页 共{2}条记录 每页{3}条</span></div>", new object[] { this.NetPagerParameter.CurrentPageIndex, this.NetPagerParameter.PageCount, this.NetPagerParameter.RecordCount, this.NetPagerParameter.PageSize }); this.gvEmailList.DataSource = dt; this.gvEmailList.DataBind(); PageBase.BindSerialRepeater(this.gvEmailList, this.NetPagerParameter.PageSize * (this.NetPagerParameter.CurrentPageIndex - 1)); }
public async Task <EmailLog> SaveLog(EmailLog log) { using (var db = new SqlConnection(ConnectionString)) { db.Open(); var cols = EmailLogCols; if (log.Id == Guid.Empty) { log.Id = Guid.NewGuid(); log.CreateDate = DateTime.UtcNow; log.ModifiedDate = DateTime.UtcNow; log.IsActive = true; await db.ExecuteAsync(BuildInsertStatement("[email].log", cols), log); } else { log.ModifiedDate = DateTime.UtcNow; try { await db.ExecuteAsync(BuildUpdateStatement("[email].log", cols), log); } catch (Exception ex) { var one = 1; } } db.Close(); return(log); } }
/// <summary> /// Log ONLY sent Emails, doesn't take care of any errors !!! /// </summary> /// <param name="IDSender">NULLABLE especially for System </param> /// <param name="EmailSender"></param> /// <param name="IDRecipient">NULLABLE</param> /// <param name="EmailRecipient"></param> /// <param name="RecipientType"></param> /// <param name="EmailType"></param> /// <param name="IDRecipientCC">NULLABLE</param> /// <param name="EmailRecipientCC">NULLABLE</param> public static void Log(Guid? IDSender, string EmailSender, Guid? IDRecipient, string EmailRecipient, TypeDestinataire RecipientType, string EmailType, Guid? IDRecipientCC = null, string EmailRecipientCC = null) { try { using (UpsilabEntities context = new UpsilabEntities()) { EmailLog pEmailLog = new EmailLog(); if (IDSender != null) pEmailLog.IDSender = IDSender.Value; pEmailLog.EmailSender = EmailSender; if (IDRecipient != null) pEmailLog.IDRecipient = IDRecipient.Value; if (IDRecipientCC != null) pEmailLog.IDRecipientCC = IDRecipientCC.Value; pEmailLog.EmailRecipient = EmailRecipient; pEmailLog.EmailRecipientCC = EmailRecipientCC; pEmailLog.RecipientType = RecipientType.ToString(); pEmailLog.EmailType = EmailType.ToString(); pEmailLog.DateCreated = DateTime.Now; context.EmailLog.AddObject(pEmailLog); context.SaveChanges(); } } catch { } }
public string GetEmailLogAttachmentsList() { #region EmailLogAttachments LPWeb.BLL.EmailLog bllEmailLog = new EmailLog(); var dt = bllEmailLog.GetEmailLogAttachments(iEmailLogID); if (dt != null && dt.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (DataRow dr in dt.Rows) { sb.Append(" <tr> "); sb.Append(" <td style=\" width:40px;\"></td>"); sb.Append(" <td><a href=\"EmailLogAttachmentsPopup.aspx?CloseDialogCodes=&EmailLogID=" + dr["EmailLogId"].ToString() + "&fileName=" + dr["Name"].ToString() + "." + dr["FileType"].ToString() + "\" target=\"_blank\" >").Append(dr["Name"].ToString()).Append(".").Append(dr["FileType"].ToString()).Append("</a></td>"); sb.Append(" </tr>"); } return(sb.ToString()); } #endregion return(string.Empty); }
public void LogarTentativaEnvio(long emailId, IEnumerable <ValidationError> erros) { var email = _repositorio.ObterPorId(emailId); email.QuantidadeDeEnvios = email.QuantidadeDeEnvios + 1; if (!_repositorio.Atualizar(email)) { return; } var mensagemErro = new StringBuilder(); if (erros != null) { foreach (var item in erros) { if (string.IsNullOrEmpty(mensagemErro.ToString())) { mensagemErro.Append(item.Message); } else { mensagemErro.Append("/ " + item.Message); } } } var emailLog = new EmailLog(email.Id, mensagemErro.ToString()); _emailLogServico.Adicionar(emailLog); }
public ResendEmailModel(EmailLog emailLog) : this() { EmailLogId = emailLog.Id; Subject = emailLog.Subject; To = emailLog.To; ToName = emailLog.ToName; }
public static void writeEmailLog(EmailLog EL, AuditLog AL) { using (POCDBContext context = new POCDBContext()) { context.spInsertEmailLog(AL.userid, AL.eventtypeid, AL.source, AL.logmessage, EL.emailaddress, EL.emailstatus); } }
public ActionResult Detail(int id) { DBEntities e = COREobject.i.Context; ViewData["SMTPServersCount"] = e.SMTPs.Count(); ViewData["EmailTemplatesCount"] = e.EmailTemplates.Count(); ViewData["EmailQueueCount"] = e.EmailQueueItems.Count(); ViewData["IncomingEmailCount"] = e.IncomingEmail.Count(); EmailLog item = e.EmailLogItems.Single(m => m.Id == id); JToken mail = JToken.Parse(item.Content); ViewData["Id"] = item.Id; ViewData["Content"] = mail["Body"]; ViewData["From_Name"] = mail["From"]["DisplayName"]; ViewData["From_Email"] = mail["From"]["Address"]; ViewData["Subject"] = mail["Subject"]; ViewData["To"] = mail["To"]; ViewData["Bcc"] = mail["Bcc"]; ViewData["CC"] = mail["CC"]; ViewData["Date_Send"] = item.DateSend.ToLongDateString(); ViewData["Status"] = item.Status == EmailSendStatus.success ? "Odesláno" : "Neodesláno"; ViewData["SMTP_Error"] = item.SMTP_Error; ViewData["Is_HTML"] = (bool)mail["IsBodyHtml"]; return(View("~/Views/Hermes/Log/Detail.cshtml")); }
public string PostEmailLog(EmailLogReq req) { try { if (req.RsvpConfimationEmail || Request.IsAuthenticated) { using (WeddingEntities context = new WeddingEntities()) { var logReq = new EmailLog { EmailId = req.EmailId, GuestDetailId = req.GuestDetailId, SentDate = DateTime.UtcNow.ToUniversalTime(), SentBy = createdBy }; context.EmailLogs.AddOrUpdate(logReq); context.SaveChanges(); return("true"); } } else { throw new Exception(); } } catch (Exception ex) { throw ex; } }
public static bool SendEmail (string fromAddress, string toAddress, string subject, string body) { var mm = new MailMessage(fromAddress, toAddress); mm.Subject = subject; mm.Body = UseTemplates ? EmailTemplate.Replace("{CONTENT}", body) : body; mm.IsBodyHtml = true; var smtp = new SmtpClient(); smtp.Send(mm); if (_logEmails) { var l = new EmailLog { SentDateTime = DateTime.Now, SentFrom = fromAddress, SentTo = toAddress, Subject = subject, Body = UseTemplates ? EmailTemplate.Replace("{CONTENT}", body) : body }; l.Insert(); } return(true); }
public async Task <bool> SendMail(Message email, string token, EmailType type) { using (var client = new HttpClient()) { client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token}"); string json = JsonConvert.SerializeObject(new { message = email }); var response = await client.PostAsync( $"https://graph.microsoft.com/v1.0/me/sendMail", new StringContent(json, Encoding.UTF8, "application/json") ); var result = response.StatusCode == HttpStatusCode.Accepted; // Zaznamenám email, ať už se poslání pomohlo či ne. var log = new EmailLog() { To = email.ToRecipients[0].EmailAddress.Address, From = this.user.Email ?? this.user.UserName, Type = type, Subject = email.Subject, Content = email.Body.Content, RentingId = email.RentingId, Sent = result, Error = result ? null : response.ReasonPhrase, }; context.EmailLog.Add(log); context.SaveChanges(); return(result); } }
/// <summary> /// Update email /// </summary> /// <param name="emailLog"></param> /// <returns></returns> public ResponseModel UpdateMail(EmailLog emailLog) { var response = Update(emailLog); return(response.SetMessage(response.Success ? T("EmailLog_Message_UpdateSuccessfully") : T("EmailLog_Message_UpdateFailure"))); }
public EmailLogDto(EmailLog el) { Id = el.Id; TakenBy = el.TakenBy; Action = el.Action; TimeActionTaken = el.TimeActionTaken; EmailId = el.EmailId; }
public MailMessage GenerateMail(EmailLog emaillog) { try { var emailfrom = System.Configuration.ConfigurationManager.AppSettings["MailFrom"]; var logourl = System.Configuration.ConfigurationManager.AppSettings["LogoUrl"]; String mailTo = emaillog.Receiver; // MailMessage mailMessage = new MailMessage(); // mailMessage.From=(new MailAddress(emailfrom, "*****@*****.**")); MailMessage mailMessage = new MailMessage(new MailAddress(emailfrom, "*****@*****.**"), new MailAddress(mailTo, emaillog.Receiver)); //string[] receivers = emaillog.Receiver.Split(';'); //foreach (string s in receivers) //{ // mailMessage.To.Add(new MailAddress(s)); //} //string[] cc = emaillog.CC.Split(';'); //foreach (string s in cc) //{ // if (s.Trim() != "") // { // mailMessage.CC.Add(new MailAddress(s)); // } //} //string[] bcc = emaillog.BCC.Split(';'); //foreach (string s in bcc) //{ // if (s.Trim() != "") // { // mailMessage.Bcc.Add(new MailAddress(s)); // } //} if (emaillog.HasAttachment) { List <EmailAttachment> attachments = _emailAttachmentQuery.GetAllList(m => m.EmailLogID == emaillog.Id).ToList(); if (attachments.Any()) { foreach (EmailAttachment attach in attachments) { if (File.Exists(attach.FilePath)) { mailMessage.Attachments.Add(new Attachment(attach.FilePath)); } } } } mailMessage.Subject = emaillog.Subject; mailMessage.IsBodyHtml = true; mailMessage.Body = emaillog.MessageBody; return(mailMessage); } catch (Exception e) { _log.Info(e); throw e; } }
public async Task <EmailLogModel> CreateMail(EmailLogModel model) { EmailLog entity = _mapper.Map <EmailLog>(model); _dbcontext.Set <EmailLog>().Add(entity); int count = await _dbcontext.SaveChangesAsync(); return(_mapper.Map <EmailLogModel>(entity)); }
public Boolean Save(Email eml) { try { EmailLog emlLog = new EmailLog(); emlLog.Code = eml.Code; emlLog.Name = emlLog.Code; emlLog.U_Attempt = 1; emlLog.U_Subject = eml.Subject; emlLog.U_Body = eml.Body; emlLog.U_EmlFrm = ""; emlLog.U_EmlTO = eml.To; if (eml.IsBodyHTML == true) { emlLog.U_IsHTML = "1"; } else { emlLog.U_IsHTML = "0"; } if (eml.IsBodyHTML == true) { emlLog.U_Subject = eml.Subject; } emlLog.U_CrtdBy = eml.User; emlLog.U_CrtdDt = DateTime.Now; if (eml.IsQueue == true) { emlLog.U_IsQ = "1"; } else { emlLog.U_IsQ = "0"; } if (eml.IsSent == true) { emlLog.U_IsSent = "1"; } else { emlLog.U_IsSent = "0"; } emlLog.U_FailedReason1 = eml.FailedReason; _context.EmailLog.Add(emlLog); _context.SaveChanges(); //return true; return(true); } catch (Exception ex) { return(false); } }
public ActionResult DeleteConfirmed(int id) { fillUserData(); EmailLog emaillog = db.EmailLogs.Find(id); db.EmailLogs.Remove(emaillog); db.SaveChanges(); return(RedirectToAction("Index")); }
public static EmailStatus SendEmail(ViewEmail from, string toEmail, string subject, string textMessage, string userID) { if (String.IsNullOrWhiteSpace(from.Title)) { from.Title = "آنلاین استور"; } string body = renderEmailBody(textMessage); var status = EmailStatus.Delivered; try { var message = new MailMessage(); message.From = new MailAddress(from.EmailAddress, from.Title, System.Text.UTF8Encoding.UTF8); message.To.Add(new MailAddress(toEmail)); message.Subject = subject; message.Body = body; message.IsBodyHtml = true; using (var smtp = new SmtpClient()) { var credential = new NetworkCredential { UserName = from.EmailAddress.Trim(), Password = from.Password.Trim() }; smtp.Credentials = credential; smtp.Host = "mail.online-store.com"; smtp.Port = 25; smtp.EnableSsl = false; smtp.Send(message); } } catch (Exception ex) { status = EmailStatus.Failed; textMessage += "\n Error:" + ex.Message; } var log = new EmailLog { From = StaticValues.InfoEmail, To = toEmail, Message = textMessage, IP = Utilities.GetIP(), LastUpdate = DateTime.Now, UserID = userID, Status = status, Key = Guid.NewGuid().ToString() }; EmailLogs.Insert(log); return(status); }
public static bool SaveLog(EmailLog item) { item.Save(); if (item.EmailLogId > 0) { return(true); } return(false); }
public Task Execute(IJobExecutionContext context) { #region Email var objEmailLogRepository = new EmailLogRepository(); var objEmailReturn = new List <EmailToManagerModel>(); var objListEmailog = new List <EmailLog>(); var objTemplateModel = new TemplateModel(); var userData = _workorderems.UserRegistrations.Where(x => x.UserId == 10073 && x.IsDeleted == false).FirstOrDefault(); var locationData = _workorderems.LocationMasters.Where(x => x.LocationId == 7 && x.IsDeleted == false).FirstOrDefault(); bool IsSent = false; var objEmailHelper = new EmailHelper(); objEmailHelper.emailid = userData.SubscriptionEmail; objEmailHelper.ManagerName = userData.FirstName + " " + userData.LastName; objEmailHelper.LocationName = locationData.LocationName; objEmailHelper.UserName = userData.FirstName + " " + userData.LastName; objEmailHelper.MailType = "EMAILDEMOSEND"; objEmailHelper.SentBy = userData.UserId; objEmailHelper.LocationID = locationData.LocationId; objEmailHelper.TimeAttempted = DateTime.UtcNow.ToMobileClientTimeZone(objTemplateModel.TimeZoneName, objTemplateModel.TimeZoneOffset, objTemplateModel.IsTimeZoneinDaylight, false).ToString(); IsSent = objEmailHelper.SendEmailWithTemplate(); //Push Notification /// string message = PushNotificationMessages.eFleetIncidentForServiceReported(objeFleetVehicleIncidentModel.LocationName, objeFleetVehicleIncidentModel.QRCodeID, objeFleetVehicleIncidentModel.VehicleNumber); //PushNotification.GCMAndroid(message, item.DeviceId, objEmailHelper); if (IsSent == true) { var objEmailog = new EmailLog(); try { objEmailog.CreatedBy = userData.UserId; objEmailog.CreatedDate = DateTime.UtcNow; objEmailog.DeletedBy = null; objEmailog.DeletedOn = null; objEmailog.LocationId = locationData.LocationId; objEmailog.ModifiedBy = null; objEmailog.ModifiedOn = null; objEmailog.SentBy = userData.UserId; objEmailog.SentEmail = userData.SubscriptionEmail; objEmailog.Subject = objEmailHelper.Subject; objEmailog.SentTo = userData.UserId; objListEmailog.Add(objEmailog); } catch (Exception) { throw; } } using (var tt = new workorderEMSEntities()) { tt.EmailLogs.AddRange(objListEmailog); tt.SaveChanges(); } return(null); }
public static void sendEmail(List <string> to, string subject, string body) { MailMessage m = new MailMessage(); SmtpClient sc = new SmtpClient(); m.From = new MailAddress("*****@*****.**"); foreach (var item in to) { m.To.Add(item); } m.Subject = subject; m.Body = body; sc.Host = "mail5004.smarterasp.net"; string str1 = "gmail.com"; string str2 = "*****@*****.**"; if (str2.Contains(str1)) { try { sc.Port = 587; sc.Credentials = new System.Net.NetworkCredential("*****@*****.**", "822357kenan$"); sc.EnableSsl = true; sc.Send(m); } catch (Exception ex) { throw ex; } } else { try { sc.Port = 25; sc.Credentials = new System.Net.NetworkCredential("*****@*****.**", "822357kenan$"); sc.EnableSsl = false; sc.Send(m); } catch (Exception ex) { throw ex; } } EmailLog log = new EmailLog(); log.CreationDate = DateTime.Now; log.LastModificationDate = DateTime.Now; log.Subject = subject; log.Body = body; log.Sender = "*****@*****.**"; log.Receiver = string.Join(";", to.ToArray()); db.EmailLogs.Add(log); db.SaveChanges(); }
private void Bind() { EmailLog.DataSource = emailLogEntries; EmailLog.DataBind(); ErrorLog.DataSource = errorLogEntries; ErrorLog.DataBind(); DBBackupPath.Text = AppSettings.DBBackupPath; }
public static void DeleteLog(EmailLog item) { if (item == null) { return; } EmailLog.Delete(item.EmailLogId); item.EmailLogId = 0; item.MarkNew(); }
private void WriteEmailLog(string serno, string content) { EmailLog entity = new EmailLog(_conn); entity.ELG_SERNO = EASONTECH.Framework2.Common.Utility.generateSerialNum(); entity.EML_SERNO = serno; entity.ELG_CONTENT = content; entity.ELG_DTTM = DateTime.Now; entity.insert(); }
public EmailLog RetrieveEmailLogByDate(string logDate) { EmailLog emailLog = new EmailLog(); var log = repository.RetrieveEmailLog(logDate); if (log != null) { emailLog = new EmailLog(log); } return(emailLog); }
public ActionResult Edit([Bind(Include = "id,Sender,Receiver,Subject,Body,CreationDate,LastModificationDate")] EmailLog emaillog) { fillUserData(); if (ModelState.IsValid) { db.Entry(emaillog).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(emaillog)); }
public void SendPasswordResetEmail(ApplicationUser mUser, string resetUrl) { try { EmailTemplate emailFormat = _emailTemplateRepositoryQuery.GetAllList(m => m.Code == "F_PASSWORD").SingleOrDefault(); List <EmailToken> tokenCol = _emailTokenRepositoryQuery.GetAllList(m => m.EmailCode == emailFormat.Code).ToList(); foreach (var token in tokenCol) { if (token.Token.Equals("{Name}")) { token.PreviewText = mUser.FirstName + " " + mUser.LastName; } else if (token.Token.Equals("{Email}")) { token.PreviewText = mUser.Email ?? string.Empty; } else if (token.Token.Equals("{Url}")) { token.PreviewText = resetUrl; } } try { EmailLog mlog = new EmailLog(); mlog.Receiver = mUser.Email; mlog.Sender = ExtentionUtility.GetAppSetting("MailFrom"); mlog.Subject = "Password Reset Notification"; mlog.MessageBody = ExtentionUtility.GeneratePreviewHTML(emailFormat.Body, tokenCol); mlog.DateCreated = mlog.DateToSend = DateTime.Now; mlog.IsSent = mlog.HasAttachment = false; mlog.EmailAttachments = new List <EmailAttachment>(); _emailLogRepositoryCommand.Insert(mlog); _emailLogRepositoryCommand.SaveChanges(); } catch (DbEntityValidationException filterContext) { if (typeof(DbEntityValidationException) == filterContext.GetType()) { foreach (var validationErrors in filterContext.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { System.Diagnostics.Debug.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } } throw; } } catch { throw; } }
public async Task <bool> LogEmailTransactionAsync(EmailLog emailLog) { if (emailLog != null) { await _context.AddAsync(emailLog); //await _context.SaveChangesAsync(); return(true); } return(false); }
public async Task <bool> UpdateEmailAsync(EmailLog emailLog) { if (emailLog != null) { _context.Update(emailLog); await _context.SaveChangesAsync(); return(true); } return(false); }
public string ResentEmail(Email emailDetail) { string result = string.Empty; try { EmailLog bl = new EmailLog(); result = bl.ResentEmail(emailDetail); } catch (Exception ex) { throw; } return(result); }
public static void writeEmailLog(EmailLog EL,AuditLog AL) { using (POCDBContext context = new POCDBContext()) { context.spInsertEmailLog(AL.userid, AL.eventtypeid, AL.source, AL.logmessage, EL.emailaddress, EL.emailstatus); } }
public bool emailLog(AuditLog AL, EmailLog EL) { DataStore.writeEmailLog( EL, AL); return true; }
partial void InsertEmailLog(EmailLog instance);
partial void UpdateEmailLog(EmailLog instance);
partial void DeleteEmailLog(EmailLog instance);