public bool send(EmailVo email)
        {
            MailMessage message = new MailMessage();

              var nc = (NetworkCredential)smtpClient.Credentials;

              if (string.IsNullOrEmpty(email.fromEmail))
                  email.fromEmail = nc.UserName;

              message.IsBodyHtml = true;
              message.Subject = email.subject;

              message.Body = email.body;

            message.BodyEncoding = Encoding.GetEncoding("Windows-1254"); // Turkish Character Encoding

            message.From = new MailAddress(email.fromEmail, email.fromName);
            message.ReplyToList.Add(new MailAddress(email.fromEmail, email.fromName));

            message.To.Add(new MailAddress(email.toEmail));

            smtpClient.EnableSsl = true;

            smtpClient.Send(message);

            return true;
        }
Exemple #2
0
        public bool send(EmailVo email)
        {
            MailMessage message = new MailMessage();

            var nc = (NetworkCredential)smtpClient.Credentials;

            if (string.IsNullOrEmpty(email.fromEmail) && nc != null)
            {
                email.fromEmail = nc.UserName;
            }

            message.IsBodyHtml = true;
            message.Subject    = email.subject;

            message.Body = email.body;

            message.BodyEncoding = Encoding.GetEncoding("Windows-1252");

            if (email.fromEmail != null)
            {
                message.From = new MailAddress(email.fromEmail, email.fromName);
                message.ReplyToList.Add(new MailAddress(email.fromEmail, email.fromName));
            }

            message.To.Add(new MailAddress(email.toEmail));

            smtpClient.EnableSsl = true;

            smtpClient.Send(message);

            return(true);
        }
        public bool send(string fromName, string toEmail, string subject, string body, string fromEmail = null)
        {
            var vo = new EmailVo();
            vo.fromName = fromName;
            vo.subject = subject;
            vo.toEmail = toEmail;
            vo.body = body;
            vo.fromEmail = fromEmail;

            return send(vo);
        }
Exemple #4
0
        public bool send(string fromName, string toEmail, string subject, string body, string fromEmail = null)
        {
            var vo = new EmailVo();

            vo.fromName  = fromName;
            vo.subject   = subject;
            vo.toEmail   = toEmail;
            vo.body      = body;
            vo.fromEmail = fromEmail;

            return(send(vo));
        }