Esempio n. 1
0
        public static string Encrypt(string unencrypted)
        {
            EncryptDecrypt ed      = new EncryptDecrypt();
            var            encoder = new ASCIIEncoding();

            return(Convert.ToBase64String(ed.Encrypt(encoder.GetBytes(unencrypted))));
        }
Esempio n. 2
0
        public static void Send(Testimonial userDetails, string rootUrl)
        {
            string name  = userDetails.Name;
            string date  = userDetails.Date;
            string email = userDetails.Email;

            string value     = userDetails.ToString();
            var    encrypted = EncryptDecrypt.Encrypt(value);

            string url = rootUrl + "/?" + encrypted;

            MailAddress from = new MailAddress("*****@*****.**",
                                               "Ballyglass Thatched Cottage",
                                               System.Text.Encoding.UTF8);

            SmtpClient client = new SmtpClient()
            {
                Host                  = "smtp.gmail.com",
                Port                  = 587,
                EnableSsl             = true,
                DeliveryMethod        = System.Net.Mail.SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials           = new NetworkCredential(from.Address, "ballyglass1A")
            };



            MailAddress to = new MailAddress(email);

            MailMessage message = new MailMessage(from, to);

            message.Body    = string.Format("Dear {0}, Thank you for Visiting us at Ballyglass Thatched Cottage. Please add a comment about your visit by visiting our page: {1}. Thank you, Niall Fallon.", name, url);
            message.Subject = "Ballyglass Thatched Cottage - Thank You!";
            //message.SubjectEncoding = System.Text.Encoding.UTF8;

            client.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback);


            client.SendAsync(message, email);

            //client.SendAsyncCancel();

            //message.Dispose();
        }
 public static string Encrypt(string unencrypted)
 {
     EncryptDecrypt ed = new EncryptDecrypt();
     var encoder = new ASCIIEncoding();
     return Convert.ToBase64String(ed.Encrypt(encoder.GetBytes(unencrypted)));
 }