public void SendCandidateEmailMessageWithAttachmentsTest() { DeleteAllTestMessages(); EmailMessage message1 = PrepareMailMessageWithAttachments(); EmailMessage message2 = PrepareMailMessageWithAttachments(); EmailMessageCollection messages = new EmailMessageCollection(); messages.Add(message1); messages.Add(message2); EmailMessageAdapter.Instance.Insert(messages); try { SmtpParameters sp = PrepareSmtpParameters(); EmailMessageAdapter.Instance.SendCandidateMessages(10, sp); CheckSentMessage(message1); CheckSentMessage(message2); } finally { DeleteAllTestMessages(); } }
public EmailMessageCollection LoadCandidateMessages(int batchCount) { string topDesp = batchCount >= 0 ? string.Format(" TOP {0} ", batchCount) : string.Empty; WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder(); builder.AppendItem("1", 1); builder.AppendTenantCode(); string sql = string.Format("SELECT {0}* FROM MSG.EMAIL_MESSAGES WITH (UPDLOCK, READPAST) WHERE {1} ORDER BY SORT_ID", topDesp, builder.ToSqlString(TSqlBuilder.Instance)); EmailMessageCollection result = new EmailMessageCollection(); DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0]; foreach (DataRow row in table.Rows) { EmailMessage message = new EmailMessage(); DataRowToEmailMessage(row, message); result.Add(message); } return(result); }
public void Send(EmailMessage message, SmtpParameters sp, bool throwError = false) { EmailMessageCollection messages = new EmailMessageCollection(); messages.Add(message); Send(messages, sp, throwError); }
public void Send(EmailMessage message, SmtpParameters sp) { EmailMessageCollection messages = new EmailMessageCollection(); messages.Add(message); Send(messages, sp); }
public void SendEmailMessageWithAttachmentTest() { EmailMessage message = PrepareMailMessageWithAttachments(); SmtpParameters sp = PrepareSmtpParameters(); EmailMessageCollection messages = new EmailMessageCollection(); messages.Add(message); EmailMessageAdapter.Instance.Send(messages, sp); }
public EmailMessageCollection LoadCandidateMessages(int batchCount) { string topDesp = batchCount >= 0 ? string.Format(" TOP {0} ", batchCount) : string.Empty; WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder(); builder.AppendItem("1", 1); builder.AppendTenantCode(); string sql = string.Format("SELECT {0}* FROM MSG.EMAIL_MESSAGES WITH (UPDLOCK READPAST) WHERE {1} ORDER BY SORT_ID", topDesp, builder.ToSqlString(TSqlBuilder.Instance)); EmailMessageCollection result = new EmailMessageCollection(); DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0]; foreach (DataRow row in table.Rows) { EmailMessage message = new EmailMessage(); DataRowToEmailMessage(row, message); result.Add(message); } return result; }