Beispiel #1
0
        public static void Main()
        {
            Mailgun.Init("key-afy6amxoo2fnj$u@mc");

            Route route = new Route("*@samples.mailgun.org", "http://samples.mailgun.org/feedback");

            try
            {
                // Create new route
                route.Upsert();
                printRoutes();

                // Update it
                updateRoutes();
                printRoutes();

                // And remove
                deleteRoutes();
                printRoutes();
            }
            catch (MailgunException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        public static void Main()
        {
            Mailgun.Init("key-afy6amxoo2fnj$u@mc");

            Mailbox mailbox = new Mailbox("new1", "samples.mailgun.org", "123123");

            try {
                // Create new mailbox
                mailbox.Upsert();

                // Update it
                mailbox.Password = "******";
                mailbox.Upsert();

                // Upsert from CSV
                Mailbox.UpsertFromCsv(Encoding.UTF8.GetBytes("[email protected], abc123\[email protected], 321bca"));

                //Now enjoy the scene:
                List <Mailbox> list = Mailbox.Find();
                Console.WriteLine("Mailboxes:\n");
                foreach (Mailbox m in list)
                {
                    Console.WriteLine("{0}@{1} {2}", m.User, m.Domain, m.Size);
                }
            } catch (MailgunException ex) {
                Console.WriteLine(ex.StackTrace);
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #3
0
        public void SendConfirmationEmail(MembershipUser user)
        {
            Mailgun.Init("key-4otkg7cfsi5qn9f$e9");

            string confirmationGuid = user.ProviderUserKey.ToString();
            string verifyUrl        = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/account/verify?ID=" + confirmationGuid;
            string sender           = "*****@*****.**";
            string recipients       = user.Email;

            MailgunMessage.SendText(sender, recipients, "Owlas - Confirmação de registo", "Para confirmares o teu endereço de email e ires para o owlas carrega neste link:\n\n" + verifyUrl + "\n\n\nA equipa owlas.com");
        }
        public static void Main()
        {
            Mailgun.Init("key-afy6amxoo2fnj$u@mc");

            try
            {
                string sender     = "*****@*****.**";
                string recipients = "You <*****@*****.**>, [email protected]";
                string rawMime    =
                    @"X-Priority: 1 (Highest)
X-Mailgun-Tag: sample_raw
Content-Type: text/plain;charset=UTF-8
From: [email protected]
To: [email protected]
Subject: Hello raw API!

This message is sent by Mailgun C# API";

                // Send a simpe text message
                MailgunMessage.SendText(sender, recipients,
                                        "Hello text API!", "Hi!\nI am sending the message using Mailgun C# API");

                // Send a simpe text message and tag it
                var options = new MailgunMessage.Options();
                options.SetHeader(MailgunMessage.MAILGUN_TAG, "sample_text");
                MailgunMessage.SendText(sender, recipients,
                                        "Hello text API + tag!", "Hi!\nI am sending the message using Mailgun C# API and setting the tag",
                                        options);

                // Send a MIME message
                MailgunMessage.SendRaw(sender, recipients, Encoding.UTF8.GetBytes(rawMime));

                // .NET Framework also has System.Net.Mail.MailMessage class which simplifies
                // MIME constriction. MailMessage can be sent by System.Net.Mail.SmtpClient class.
                // Login into Mailgun Control Panel and look for your SMTP server address, user and password.

                Console.WriteLine("Messages sent");
            }
            catch (MailgunException ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }