예제 #1
0
        public virtual ISmtpContext GetSmtpContext()
        {
            var ctx = FactorySmtpContext.CreateSmtpObject("SendGridSmtpContext");

            ctx.SetSmtpConfigByEnv("MAGNUM_SMTP_HOST", "MAGNUM_SMTP_PORT", "MAGNUM_SMTP_USER", "MAGNUM_SMTP_PASSWORD");

            return(ctx);
        }
        public void SendEmailTest(string to, string from, string fromName)
        {
            var ctx = FactorySmtpContext.CreateSmtpObject("SendGridSmtpContext");

            ctx.SetSmtpConfigByEnv("ONIX_SMTP_HOST", "ONIX_SMTP_PORT", "ONIX_SMTP_USER", "ONIX_SMTP_PASSWORD");

            Mail m = new Mail();

            m.FromName      = fromName;
            m.From          = from;
            m.To            = to;
            m.Subject       = "This is sent from unit test";
            m.IsHtmlContent = false;
            m.Body          = "This is body text sent from unit test";
            m.BCC           = "";
            m.CC            = "";

            ctx.Send(m);
        }