Пример #1
0
        /// <summary>
        /// Send mail
        /// </summary>
        /// <param name="name">
        /// </param>
        /// <param name="email">
        /// </param>
        /// <param name="subject">
        /// </param>
        /// <param name="message">
        /// </param>
        /// <returns>
        /// </returns>
        public static String SendMail(string name, string email, string subject, string message)
        {
            const bool error = false;
            var        body  = PopulateBody(name, message);

            try
            {
                var mailMessage = new MailMessage();
                mailMessage.To.Add(ContactPluginSettingsModel.GetEmail());
                mailMessage.From       = new MailAddress(email);
                mailMessage.Subject    = subject;
                mailMessage.Body       = body;
                mailMessage.IsBodyHtml = true;
                var smtpClient = new SmtpClient("145.118.4.13");
                smtpClient.Send(mailMessage);
            }
            // ReSharper disable EmptyGeneralCatchClause
            catch (Exception)
            // ReSharper restore EmptyGeneralCatchClause
            {
            }
            return(error.ToString());
        }
Пример #2
0
 public String GetEmail()
 {
     return(ContactPluginSettingsModel.GetEmail());
 }