Exemplo n.º 1
0
        public void SendDataInvalidRecipients()
        {
            var random = new Random();

            byte[] bytes = new byte[23];
            random.NextBytes(bytes);
            MailGun.Send(StringHelper.ValidString(), StringHelper.NullEmptyWhiteSpace(), bytes);
        }
Exemplo n.º 2
0
        public Guid Send(BinaryEmail email)
        {
            Contract.Requires <ArgumentNullException>(null != email);

            Contract.Requires <ArgumentOutOfRangeException>(!string.IsNullOrWhiteSpace(email.Sender));
            Contract.Requires <ArgumentOutOfRangeException>(!string.IsNullOrWhiteSpace(email.Recipient));

            Contract.Requires <ArgumentOutOfRangeException>(null != email.RawMessage);

            MailGun.Send(email.Sender, email.Recipient, email.RawMessage);

            var table = new AzureTable <BinaryEmailData>(ServerConfiguration.Default);
            var data  = email.Convert();

            table.AddEntity(data);

            return(data.Id);
        }
Exemplo n.º 3
0
        /// <summary>
        /// This is where we should do the actual email send to the user.
        /// </summary>
        /// <param name="to">To Email Address</param>
        /// <param name="from">From Email Address</param>
        /// <param name="subject">Title</param>
        /// <param name="body">Body</param>
        private void Send(string to, string from, string fromName, string subject, string body)
        {
            if (string.IsNullOrWhiteSpace(from))
            {
                throw new ArgumentException("from");
            }

            if (!string.IsNullOrWhiteSpace(to))
            {
                var sent = false;
                try
                {
                    var email    = new MailGun();
                    var response = email.Send(from, fromName, to, subject, body);
                    sent = true;
                    //sent = response.StatusCode == System.Net.HttpStatusCode.OK;
                }
                catch
                {
                }

                this.Archive(from, fromName, to, subject, body, sent);
            }
        }
Exemplo n.º 4
0
 public void SendData()
 {
     MailGun.Send("*****@*****.**", "*****@*****.**", Guid.NewGuid().ToByteArray());
 }
Exemplo n.º 5
0
 public void SendText()
 {
     MailGun.Send("*****@*****.**", "*****@*****.**", "This is a test email message", string.Format("this is a test message{0}; which is suppose to have text in it.", StringHelper.ValidString()));
 }
Exemplo n.º 6
0
 public void SendDataEmptyMime()
 {
     byte[] bytes = new byte[0];
     MailGun.Send(StringHelper.ValidString(), StringHelper.NullEmptyWhiteSpace(), bytes);
 }
Exemplo n.º 7
0
 public void SendDataNullMime()
 {
     MailGun.Send(StringHelper.ValidString(), StringHelper.ValidString(), null);
 }
Exemplo n.º 8
0
 public void SendTextNullText()
 {
     MailGun.Send(StringHelper.ValidString(), StringHelper.ValidString(), string.Empty, null);
 }
Exemplo n.º 9
0
 public void SendTextNullSubject()
 {
     MailGun.Send(StringHelper.ValidString(), StringHelper.ValidString(), null, string.Empty);
 }
Exemplo n.º 10
0
 public void SendTextInvalidRecipients()
 {
     MailGun.Send(StringHelper.ValidString(), StringHelper.NullEmptyWhiteSpace(), string.Empty, string.Empty);
 }