Example #1
0
        private static async Task SendCustomWithNoReturnType()
        {
            var customEmail = new CustomEmail()
            {
                Name = "Custom Test"
            };

            await EmailCourier.Init().To("*****@*****.**")
            .Cc("*****@*****.**")
            .From("*****@*****.**")
            .Subject("Hello")
            .WithTemplate(AppDomain.CurrentDomain.BaseDirectory, "/src/Emails/HelloEmail.cshtml")
            .Send((message) =>
            {
                LogToConsole(message);
            }, customEmail);
        }
Example #2
0
        static async Task AsyncMain()
        {
            await SendCustomWithGenericReturnType();

            Console.WriteLine("Sending hello email with template");

            await EmailCourier.Init().To("*****@*****.**")
            .Cc("*****@*****.**")
            .From("*****@*****.**")
            .Subject("Hello")
            .WithTemplate(AppDomain.CurrentDomain.BaseDirectory, "/src/Emails/HelloEmail.cshtml")
            .Send(new HelloEmailBody()
            {
                Name = "Test Name"
            });

            Console.WriteLine("Email Sent...");

            Console.WriteLine("Sending fluent email with template");

            await EmailCourier.Init().To("*****@*****.**")
            .Cc("*****@*****.**")
            .From("*****@*****.**")
            .Subject("Hello")
            .WithTemplate(AppDomain.CurrentDomain.BaseDirectory, "/src/Emails/FluentEmailHelp.cshtml")
            .Send(new FluentEmailBody()
            {
                Number = 123453
            });

            Console.WriteLine("Email Sent...");

            await SendCustomWithNoReturnType();

            await SendBulk();

            Console.WriteLine("Press any key to exit...");
            Console.Read();
        }
Example #3
0
        private static async Task <CustomEmailResult> SendCustomWithGenericReturnType()
        {
            var customEmail = new CustomEmail()
            {
                Name = "Custom Test"
            };

            return(await EmailCourier.Init().To("*****@*****.**")
                   .Cc("*****@*****.**")
                   .From("*****@*****.**")
                   .Subject("Hello")
                   .WithTemplate(AppDomain.CurrentDomain.BaseDirectory, "/src/Emails/HelloEmail.cshtml").Send(input =>
            {
                // Do custom work after send here
                var result = new CustomEmailResult()
                {
                    IsSuccess = true
                };

                return result;
            }, customEmail));
        }
Example #4
0
        public static async Task SendBulk()
        {
            var emails = new List <EmailSendBulk>()
            {
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                },
                new EmailSendBulk()
                {
                    Cc = "*****@*****.**", From = "*****@*****.**", Name = "Hello", Subject = "Hello", To = "*****@*****.**"
                }
            };

            await EmailCourier.Init().WithTemplateForBulk(AppDomain.CurrentDomain.BaseDirectory, "/src/Emails/HelloEmail.cshtml").SendBulk(emails);
        }