예제 #1
0
        public async Task Should_Send_Raw_Message()
        {
            // Setup
            string apiKey    = ConfigurationManager.AppSettings["APIKey"];
            string toEmail   = ConfigurationManager.AppSettings["ValidToEmail"];
            string fromEmail = ConfigurationManager.AppSettings["FromEMail"];

            // Exercise
            var api = new MandrillApi(apiKey);

            string message = "From: " + fromEmail + "\n" +
                             "Subject: Mandrill Integration Test Raw\n" +
                             "To: " + toEmail + "\n" +
                             "MIME-Version: 1.0\n" +
                             "Content-Type: text/html; charset=utf-8\n" +
                             "Content-Transfer-Encoding: 7bit\n" +
                             "\n" +
                             "Test\n";
            List <EmailResult> result = await api.SendRawMessage(new SendRawMessageRequest(message)
            {
                ToEmails = new List <string> {
                    toEmail
                },
                FromEmail = fromEmail,
                FromName  = ""
            });

            // Verify
            Assert.AreEqual(1, result.Count);
            Assert.AreEqual(toEmail, result.First().Email);
            Assert.AreEqual(EmailResultStatus.Sent, result.First().Status);
        }
예제 #2
0
    public async Task Should_Send_Raw_Message()
    {
      // Setup
      string apiKey = ConfigurationManager.AppSettings["APIKey"];
      string toEmail = ConfigurationManager.AppSettings["ValidToEmail"];
      string fromEmail = ConfigurationManager.AppSettings["FromEMail"];

      // Exercise
      var api = new MandrillApi(apiKey);

      string message = "From: " + fromEmail + "\n" +
                       "Subject: Mandrill Integration Test Raw\n" +
                       "To: " + toEmail + "\n" +
                       "MIME-Version: 1.0\n" +
                       "Content-Type: text/html; charset=utf-8\n" +
                       "Content-Transfer-Encoding: 7bit\n" +
                       "\n" +
                       "Test\n";
      List<EmailResult> result = await api.SendRawMessage(new SendRawMessageRequest(message)
      {
        ToEmails = new List<string> {toEmail},
        FromEmail = fromEmail,
        FromName = ""
      });
      // Verify
      Assert.AreEqual(1, result.Count);
      Assert.AreEqual(toEmail, result.First().Email);
      Assert.AreEqual(EmailResultStatus.Sent, result.First().Status);
    }
예제 #3
0
        public void Raw_Message_Is_Sent()
        {
            // Setup
            var    apiKey    = ConfigurationManager.AppSettings["APIKey"];
            string toEmail   = ConfigurationManager.AppSettings["ValidToEmail"];
            string fromEmail = ConfigurationManager.AppSettings["FromEMail"];

            // Exercise
            var api = new MandrillApi(apiKey);

            var message = "From: " + fromEmail + "\n" +
                          "Subject: Mandrill Integration Test Raw\n" +
                          "To: " + toEmail + "\n" +
                          "MIME-Version: 1.0\n" +
                          "Content-Type: text/html; charset=utf-8\n" +
                          "Content-Transfer-Encoding: 7bit\n" +
                          "\n" +
                          "Test\n";
            var result = api.SendRawMessage(new EmailMessage
            {
                to =
                    new List <EmailAddress> {
                    new EmailAddress {
                        email = toEmail, name = ""
                    }
                },
                from_email  = fromEmail,
                from_name   = "",
                raw_message = message,
                raw_to      = new List <string> {
                    toEmail
                }
            });

            // Verify
            Assert.AreEqual(1, result.Count);
            Assert.AreEqual(toEmail, result.First().Email);
            Assert.AreEqual(EmailResultStatus.Sent, result.First().Status);
        }
        public void Raw_Message_Is_Sent()
        {
            // Setup
            var apiKey = ConfigurationManager.AppSettings["APIKey"];
            string toEmail = ConfigurationManager.AppSettings["ValidToEmail"];
            string fromEmail = ConfigurationManager.AppSettings["FromEMail"];

            // Exercise
            var api = new MandrillApi(apiKey);

            var message = "From: " + fromEmail + "\n" +
                "Subject: Mandrill Integration Test Raw\n" +
                "To: " + toEmail + "\n" +
                "MIME-Version: 1.0\n" +
                "Content-Type: text/html; charset=utf-8\n" +
                "Content-Transfer-Encoding: 7bit\n" +
                "\n" +
                "Test\n";
            var result = api.SendRawMessage(new EmailMessage
                                             {
                                                 to =
                                                     new List<EmailAddress> { new EmailAddress { email = toEmail, name = "" } },
                                                 from_email = fromEmail,
                                                 from_name = "",
                                                 raw_message = message
                                             });
            // Verify
            Assert.AreEqual(1, result.Count);
            Assert.AreEqual(toEmail, result.First().Email);
            Assert.AreEqual(EmailResultStatus.Sent, result.First().Status);
        }