public MailMessage GenerateMail()
        {
            var subject    = "Good Morning " + Configuration.Instance.GetSetting(Configuration.INTERNAL_SETTINGS_SUBJECT_TAG);
            var attachment = GetRandomAttachment();
            var body       = GetMessage(attachment);

            if (attachment == null)
            {
                return(null);
            }

            var mailMan = new MailService();
            var mail    = mailMan.CreateMail(subject, body, attachment);

            return(mail);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var mailMan   = new MailService();
            var generator = new MailGenerator();
            var mail      = generator.GenerateMail();

            if (mail != null && mailMan.SendMail(mail))
            {
                Logger.Instance.LogMailEntry(mail);

                // Increment the subject setting
                Configuration.Instance.SetSetting(Configuration.INTERNAL_SETTINGS_SUBJECT_TAG,
                                                  GetNewSubjectSetting().ToString(CultureInfo.CurrentCulture));
                Configuration.Instance.SaveSettings();
            }
        }