コード例 #1
0
ファイル: Processor.cs プロジェクト: JonathanValle/mixerp
        public void Send(string sendTo, string subject, string body, IEnumerable<Attachment> attachments)
        {
            Config config = new Config();

            EmailMessage email = new EmailMessage
            {
                FromName = config.FromName,
                FromEmail = config.FromEmail,
                Subject = subject,
                SentTo = sendTo,
                Message = body,
                Type = Type.Outward,
                EventDateUTC = DateTime.UtcNow,
                Status = Status.Unknown
            };

            SmtpHost host = new SmtpHost
            {
                Address = config.SmtpHost,
                Port = config.SmtpPort,
                EnableSSL = config.EnableSsl,
                DeliveryMethod = config.DeliveryMethod,
                PickupDirectory = config.PickupDirectory
            };

            ICredentials credentials = new SmtpCredentials
            {
                Username = config.SmtpUsername,
                Password = config.SmtpUserPassword
            };

            this.Send(email, host, credentials, attachments);
        }
コード例 #2
0
ファイル: Processor.cs プロジェクト: njmube/mixerp
        public async Task<bool> Send(string sendTo, string subject, string body, bool deleteAttachmentes,
            params string[] attachments)
        {
            Config config = new Config(this.Catalog);

            if (!config.Enabled)
            {
                return false;
            }


            EmailMessage email = new EmailMessage
            {
                FromName = config.FromName,
                FromEmail = config.FromEmail,
                Subject = subject,
                SentTo = sendTo,
                Message = body,
                Type = Type.Outward,
                EventDateUTC = DateTime.UtcNow,
                Status = Status.Unknown
            };

            SmtpHost host = new SmtpHost
            {
                Address = config.SmtpHost,
                Port = config.SmtpPort,
                EnableSSL = config.EnableSsl,
                DeliveryMethod = config.DeliveryMethod,
                PickupDirectory = config.PickupDirectory
            };

            ICredentials credentials = new SmtpCredentials
            {
                Username = config.SmtpUsername,
                Password = config.SmtpUserPassword
            };

            return await this.Send(email, host, credentials, deleteAttachmentes, attachments);
        }
コード例 #3
0
ファイル: Processor.cs プロジェクト: AYCHErp/AYCH-mixerp
        public async Task <bool> Send(string sendTo, string subject, string body, bool deleteAttachmentes,
                                      params string[] attachments)
        {
            Config config = new Config(this.Catalog);

            if (!config.Enabled)
            {
                return(false);
            }


            EmailMessage email = new EmailMessage
            {
                FromName     = config.FromName,
                FromEmail    = config.FromEmail,
                Subject      = subject,
                SentTo       = sendTo,
                Message      = body,
                Type         = Type.Outward,
                EventDateUTC = DateTime.UtcNow,
                Status       = Status.Unknown
            };

            SmtpHost host = new SmtpHost
            {
                Address         = config.SmtpHost,
                Port            = config.SmtpPort,
                EnableSSL       = config.EnableSsl,
                DeliveryMethod  = config.DeliveryMethod,
                PickupDirectory = config.PickupDirectory
            };

            ICredentials credentials = new SmtpCredentials
            {
                Username = config.SmtpUsername,
                Password = config.SmtpUserPassword
            };

            return(await this.Send(email, host, credentials, deleteAttachmentes, attachments));
        }