コード例 #1
0
            internal void Populate(Settings settings)
            {
                var s = settings.Email;

                if (ToAddress.HasValue())
                {
                    s.ToAddress = ToAddress;
                }
                if (FromAddress.HasValue())
                {
                    s.FromAddress = FromAddress;
                }
                if (FromDisplayName.HasValue())
                {
                    s.FromDisplayName = FromDisplayName;
                }
                if (SMTPHost.HasValue())
                {
                    s.SMTPHost = SMTPHost;
                }
                if (SMTPPort.HasValue)
                {
                    s.SMTPPort = SMTPPort;
                }
                if (SMTPUserName.HasValue())
                {
                    s.SMTPUserName = SMTPUserName;
                }
                if (SMTPPassword.HasValue())
                {
                    s.SMTPPassword = SMTPPassword;
                }
                if (SMTPEnableSSL.HasValue)
                {
                    s.SMTPEnableSSL = SMTPEnableSSL.Value;
                }
                if (PreventDuplicates.HasValue)
                {
                    s.PreventDuplicates = PreventDuplicates.Value;
                }

                if (s.ToAddress.HasValue())
                {
                    EmailNotifier.Setup(s);
                }
            }
コード例 #2
0
 public void SendEmail(IEnumerable <string> addressList, string subject, string content)
 {
     try
     {
         var host       = SMTPHost.FromConfiguration();
         var smtpClient = host.IsMockHost ? new MockSMTPClient() : ApplicationSettings.Container.Resolve <ISMTPClient>();
         smtpClient.SendEmail(host, addressList, subject, content);
     }
     catch (GOServerException)
     {
         throw;
     }
     catch (Exception e)
     {
         throw new GOServerException <SendEmailFailed>(e);
     }
 }