Exemplo n.º 1
0
        /// <summary>
        /// Get a summarized report of sent messages
        /// </summary>
        /// <param name="status">Email send status, the possible values are (Queued , Sent and Failed )</param>
        /// <param name="dateFrom">The start date for the report time interval</param>
        /// <param name="dateTo">The end date for the report time interval</param>
        /// <param name="from">Filter report base on from email address</param>
        /// <param name="subject">Subject of the email , default subject is used unless stated</param>
        public virtual GetEmailsReportResult GetEmailsReport(EmailStatus? status = null, 
            DateTime? dateFrom = null,DateTime? dateTo = null, string from = null, string subject = null)
        {
            var request = new RestRequest(Method.POST) { Resource = "Email/GetEmailsReport" };

            if (status.HasValue) request.AddParameter("Status", status.Value);
            if (dateFrom.HasValue) request.AddParameter("DateFrom", dateFrom.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
            if (dateTo.HasValue) request.AddParameter("DateTo", dateTo.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
            if (from.HasValue()) request.AddParameter("From", from);
            if (subject.HasValue()) request.AddParameter("Subject", subject);
            return Execute<GetEmailsReportResult>(request);
        }
Exemplo n.º 2
0
 public void VerifyEmail(string FirstName, string MiddleName, string LastName, string Domain)
 {
     try {
         //SingleEmail em = new SingleEmail(FirstName, MiddleName, LastName, Domain);
         eStatus = new EmailStatus();
         eStatus.Email = FirstName + MiddleName + LastName + "@" + Domain;
         ValidateWithBriteVerify();
         Result = true;
     }catch(Exception e){
         Error = e.Message;
         Result = false;
     }
 }
Exemplo n.º 3
0
        private void UpdateList()
        {
            Console.Clear();
            GetListOfCustomers();

            Console.WriteLine("What is the first name of the customer you are trying to change?");
            string ChangeFirstName = Console.ReadLine();

            Console.WriteLine("What is the last name of the customer you are trying to change?");
            string ChangeLastName = Console.ReadLine();

            Console.WriteLine("What would you like to change?\n" +
                              "1. FirstName\n" +
                              "2. Last Name\n" +
                              "3. Type of Customer\n" +
                              "4. Email");
            string UserinputFromMenu = Console.ReadLine().ToLower();

            switch (UserinputFromMenu)
            {
            case "1":
            case "first name":
                Console.WriteLine("What is the first name of the customer now?");
                string UpdatedFirstName = Console.ReadLine();
                _emailRepo.UpdateCustomerListByFirstNameSpecification(ChangeFirstName, ChangeLastName, UpdatedFirstName);
                break;

            case "2":
            case "last name":
                Console.WriteLine("What is the last name of the customer now?");
                string UpdatedLastName = Console.ReadLine();
                _emailRepo.UpdateCustomerListByLastNameSpecification(ChangeFirstName, ChangeLastName, UpdatedLastName);
                break;

            case "3":
            case "type":
                Console.WriteLine("what is the Type of customer?\n" +
                                  "1. Potential\n" +
                                  "2. Current\n" +
                                  "3. Past");
                string Userinput = Console.ReadLine().ToLower();

                EmailStatus _UpdatedemailStatus = new EmailStatus();
                switch (Userinput)
                {
                case "1":
                case "potential":
                    _UpdatedemailStatus = EmailStatus.Potential;
                    break;

                case "2":
                case "current":
                    _UpdatedemailStatus = EmailStatus.Current;
                    break;

                case "3":
                case "past":

                    _UpdatedemailStatus = EmailStatus.Past;
                    break;
                }
                _emailRepo.UpdateCustomerListByTypeSpecification(ChangeFirstName, ChangeLastName, _UpdatedemailStatus);
                break;

            case "4":
            case "email":
                Console.WriteLine("What is the email address of the customer now?");
                string UpdatedEmail = Console.ReadLine();
                _emailRepo.UpdateCustomerListByEmailSpecification(ChangeFirstName, ChangeLastName, UpdatedEmail);
                break;
            }
        }
Exemplo n.º 4
0
 private void UpdateStatus(EmailStatus status)
 {
     UpdateStatus(status, null);
 }
Exemplo n.º 5
0
 private MailError(EmailStatus type)
     : base(type.ToString())
 {
     ErrorCounter++;
     Type = type;
 }
Exemplo n.º 6
0
 internal Email(string emailString, EmailType type, EmailStatus status)
 {
     EmailString = emailString;
     Type        = type;
     Status      = status;
 }
Exemplo n.º 7
0
 private void UpdateStatus(EmailStatus status, ResendEmail email)
 {
     UpdateStatus(status, email, null);
 }
 public StartupEmailHostedService(IEmailSender emailSender, EmailStatus emailStatus, ILogger <StartupEmailHostedService> logger)
 {
     this.services    = services;
     this.logger      = logger;
     this.emailStatus = emailStatus;
 }
 public void UpdateCustomerListByTypeSpecification(string firstName, string lastName, EmailStatus NewType)
 {
     EmailList.Where(w => w.FirstName == firstName && w.LastName == lastName).ToList().ForEach(s => s.EmailStatusOfCustomer = NewType);
 }
Exemplo n.º 10
0
 public static Boolean IsWrong(this EmailStatus emailStatus)
 {
     return(emailStatus > EmailStatus.EmailSent);
 }
Exemplo n.º 11
0
 public async Task OnPost()
 {
     EmailStatus = await _mailService.SendAsync(EmailModel);
 }
Exemplo n.º 12
0
        public override Tuple <bool, string> Send(Notification notification)
        {
            string error = "";
            bool   skipEmailSetupCheck = false;

            // if there is no user name, or password specified, then we assume that the default email configuration
            // setup on the cloud should be used (note that we don't check the smtp server here since there is
            // always a default value on the clients)
            if (string.IsNullOrWhiteSpace(base.smtpUsername) && string.IsNullOrWhiteSpace(base.smtpPassword))
            {
                skipEmailSetupCheck = true;
            }

            if (skipEmailSetupCheck)
            {
                if (string.IsNullOrWhiteSpace(notification.toAddress) ||
                    (this.serviceHostUri == null) ||
                    string.IsNullOrWhiteSpace(this.serviceHostUri.OriginalString))
                {
                    error = "Cannot send email. Email Setup not done correctly";
                    base.logger.Log(error);
                    return(new Tuple <bool, string>(false, error));
                }
            }
            else
            {
                if (string.IsNullOrWhiteSpace(base.smtpUsername) ||
                    string.IsNullOrWhiteSpace(base.smtpServer) ||
                    string.IsNullOrWhiteSpace(base.smtpPassword) ||
                    string.IsNullOrWhiteSpace(notification.toAddress) ||
                    (this.serviceHostUri == null) ||
                    string.IsNullOrWhiteSpace(this.serviceHostUri.OriginalString))
                {
                    error = "Cannot send email. Email Setup not done correctly";
                    base.logger.Log(error);
                    return(new Tuple <bool, string>(false, error));
                }
            }

            try
            {
                // TODO: add support for attachments for cloud email relay
                EmailRequestInfo emailRequestInfo = new EmailRequestInfo(
                    base.smtpUsername,
                    base.smtpPassword,
                    base.smtpServer,
                    notification.toAddress,
                    notification.subject,
                    notification.body,
                    notification.attachmentList
                    );
                if (null != emailRequestInfo)
                {
                    string jsonString = emailRequestInfo.SerializeToJsonStream();
                    logger.Log("Sending cloud email : {0}", emailRequestInfo.ToString());
                    WebClient webClient = new WebClient();
                    webClient.Headers["Content-type"] = "application/json";
                    webClient.Encoding = Encoding.UTF8;
                    webClient.UseDefaultCredentials = true;
                    string      jsonEmailStatus = webClient.UploadString(new Uri(this.serviceHostUri.OriginalString + "/SendEmail"), "POST", jsonString);
                    EmailStatus emailStatus     = SerializerHelper <EmailStatus> .DeserializeFromJsonStream(jsonEmailStatus);

                    return(new Tuple <bool, string>(emailStatus.SendStatus == EmailSendStatus.SentSuccessfully, emailStatus.SendFailureMessage));
                }
            }
            catch (Exception exception)
            {
                error = string.Format("Exception while sending cloud email: {0}", exception.ToString());
                base.logger.Log(error);
                return(new Tuple <bool, string>(false, error));
            }

            return(new Tuple <bool, string>(true, ""));
        }
Exemplo n.º 13
0
 public String this[EmailStatus exception] =>
 this["Email", exception.ToString()];
Exemplo n.º 14
0
 public void SetEmailStatus(EmailStatus status)
 {
     Status = status;
     DomainEvents.Add(new EmailStatusChangedEvent());
 }
 public EmailTemplate Send()
 {
     this.Status = EmailStatus.Sent;
     return this;
 }
Exemplo n.º 16
0
 public void UpdateRequestEmailStatus(EmailStatus status)
 {
     this.RequestBookEmailStatus = status;
 }
Exemplo n.º 17
0
 public EmailTemplate Send()
 {
     this.Status = EmailStatus.Sent;
     return(this);
 }
Exemplo n.º 18
0
 /// <summary>
 /// 更新电子邮件状态
 /// </summary>
 /// <param name="sysNo">电子邮件编号</param>
 /// <param name="status">状态</param>
 /// <param name="note">备注</param>
 public void UpdateEmailStatus(long sysNo, EmailStatus status, string note)
 {
     string sql = @"UPDATE [SohoEmailAndSMS].[dbo].[Emails]
                       SET [Status] = @Status,
                           [LastUpdateTime] = GETDATE(),
                           [Note] = ISNULL([Note], N'') + @Note
                       WHERE [SysNo] = @SysNo";
     SqlServerDBHelper db = new SqlServerDBHelper();
     try
     {
         SqlParameter[] para = new SqlParameter[]
         {
             new SqlParameter("@SysNo", sysNo),
             new SqlParameter("@Status", status),
             new SqlParameter("@Note", note)
         };
         db.ExecuteNonQuery(CommandType.Text, sql, para);
     }
     catch (Exception ex)
     {
         Logger.WriteException(ex.ToString());
     }
     finally
     {
         db.Dispose();
     }
 }
Exemplo n.º 19
0
 public void MarkAsSent()
 {
     EmailStatus = EmailStatus.Sent;
 }
Exemplo n.º 20
0
 protected virtual void OnLatestEmailsEvent(EmailStatus e)
 {
     this.LatestEmailsEvent?.Invoke(this, e);
 }
Exemplo n.º 21
0
 public void SetSendingStatus()
 {
     Status = EmailStatus.Sending;
     LastSendingAttemptTime = DateTime.Now;
 }
Exemplo n.º 22
0
 public static MailError WithMessage(EmailStatus type)
 {
     return(new(type));
 }
Exemplo n.º 23
0
 public void SetErrorStatus(string error)
 {
     Status           = EmailStatus.Error;
     LastSendingError = error;
 }
Exemplo n.º 24
0
 public MailError(Exception e)
     : base("Exception on sending e-mail", e)
 {
     ErrorCounter++;
     Type = EmailStatus.EmailNotSent;
 }
Exemplo n.º 25
0
 public void SetSentStatus()
 {
     Status = EmailStatus.Sent;
 }
Exemplo n.º 26
0
 internal void SetStatus(EmailStatus sent)
 {
     this.Status = sent;
 }
Exemplo n.º 27
0
 internal MoveResult(Move move, EmailStatus email)
     : this(move)
 {
     Email = email;
 }
Exemplo n.º 28
0
 /// <summary>
 /// 更新电子邮件状态
 /// </summary>
 /// <param name="sysNo">电子邮件编号</param>
 /// <param name="status">状态</param>
 /// <param name="note">备注</param>
 public void UpdateEmailStatus(long sysNo, EmailStatus status, string note = "")
 {
     GetDAInstance.UpdateEmailStatus(sysNo, status, note);
 }
        public static Email CreateNew(MimeMessage message, long configId, string uniqueId, EmailType type, EmailStatus status)
        {
            var email = new Email
            {
                Body                 = !string.IsNullOrEmpty(message.TextBody) ? message.TextBody : message.HtmlBody,
                Subject              = message.Subject,
                EmailType            = type,
                HtmlBody             = message.HtmlBody,
                MessageId            = message.MessageId,
                EmailStatus          = status,
                ReadStatus           = ReadStatus.Unread,
                EmailConfigurationId = configId,
                UniqueId             = uniqueId,
                InReplyTo            = message.InReplyTo,
                Importance           = (int)message.Importance,
                XPriority            = (int)message.XPriority,
                ResentMessageId      = message.ResentMessageId,
                Priority             = (int)message.Priority,
                ResentDate           = message.ResentDate.UtcDateTime,
                Date                 = message.Date.UtcDateTime,
                ResentSender         = message.ResentSender?.Address
            };

            return(email);
        }