Example #1
0
        protected override WorkState Do(WorkState currentWorkState)
        {
            this.CheckRequiredProperties();

            WorkState result = new WorkState(this)
            {
                Status            = Status.Succeeded,
                PreviousWorkState = currentWorkState
            };

            object formatValues = new
            {
                JobName  = Job.Name.Or("[JobName Not Set]"),
                WorkName = Job.CurrentWorkerName.Or("[WorkName Not Specified]"),
                Status   = Job.CurrentWorkState.Status.ToString(),
                Message  = Job.CurrentWorkState.Message.Or(" ")
            };

            Email email = new Email();

            email.Server(SmtpHost)
            .Port(int.Parse(Port))
            .IsBodyHtml(_isBodyHtml)
            .From(From)
            .To(Recipients.DelimitSplit(",", ";"))
            .Subject(SubjectFormat.NamedFormat(formatValues))
            .Body(BodyFormat.NamedFormat(formatValues))
            .UserName(UserName)
            .Password(Password)
            .EnableSsl(_enableSsl)
            .Send();

            return(result);
        }