Exemplo n.º 1
0
        public async Task <EmailingInfoDto> GetInfoMessage(string id)
        {
            EmailingInfoDto result = null;
            MandrillApi     api    = new MandrillApi(WebConfigurationManager.AppSettings["MailServerKey"]);

            try
            {
                var info = await api.GetInfo(new MessageInfoRequest(id));

                return(new EmailingInfoDto()
                {
                    EmailId = info.Id,
                    State = info.State.ToString(),
                    Opens = info.Opens,
                    Clicks = info.Clicks
                });
                //var etc = await api.GetContent(new ContentRequest(id));
            }
            catch (Exception ex)
            {
                string err = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                //throw new WebException(err);
            }

            return(result);
        }
Exemplo n.º 2
0
        public async Task Should_Get_Information_Of_A_Sent_Email()
        {
            // Setup
            string apiKey             = ConfigurationManager.AppSettings["APIKey"];
            string sentEmailId        = ConfigurationManager.AppSettings["SentEmailId"];
            string sentEmailSubject   = ConfigurationManager.AppSettings["SentEmailSubject"];
            string sentEmailRecipient = ConfigurationManager.AppSettings["SentEmailRecipient"];

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

            MessageInfo response = await api.GetInfo(new MessageInfoRequest(sentEmailId));

            Assert.AreEqual(sentEmailSubject, response.Subject);
            Assert.AreEqual(sentEmailRecipient, response.Email);
        }
Exemplo n.º 3
0
    public async Task Should_Get_Information_Of_A_Sent_Email()
    {
      // Setup
      string apiKey = ConfigurationManager.AppSettings["APIKey"];
      string sentEmailId = ConfigurationManager.AppSettings["SentEmailId"];
      string sentEmailSubject = ConfigurationManager.AppSettings["SentEmailSubject"];
      string sentEmailRecipient = ConfigurationManager.AppSettings["SentEmailRecipient"];

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

      MessageInfo response = await api.GetInfo(new MessageInfoRequest(sentEmailId));

      Assert.AreEqual(sentEmailSubject, response.Subject);
      Assert.AreEqual(sentEmailRecipient, response.Email);
    }