Hiển thị kết quả từ 1 đến 1 / 1
  1. #1
    Tham gia
    12-10-2009
    Location
    Memory
    Bài viết
    174
    Like
    2
    Thanked 1 Time in 1 Post

    Giúp em viết code cho recaptcha với!

    em làm một trang sent mail! muốn có recaptcha để chống spam! em đã nhúng recaptcha vào webfom rùi! nhưng mà viết code để nhập dữ liệu đúng mới chạy! còn nhập sai thì báo lỗi! lại không chạy nó báo lỗi hoài! hic hic! web em asp.net các anh chị giúp em với! thanks ạ!
    đoạn code trong file .cs sent mail của em đây ạ!
    Code:
    using System;
    using System.Collections.Generic;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Net;
    using System.Net.Mail;
    
    public partial class lienhe : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
    
        }
        protected void btnSend_Click(object sender, EventArgs e)
            
            {
                SmtpClient SmtpServer = new SmtpClient();
                SmtpServer.Credentials = new System.Net.NetworkCredential("abcdef@gmail.com", "******");
                SmtpServer.Port = 587;
                SmtpServer.Host = "smtp.gmail.com";
                SmtpServer.EnableSsl = true;
                MailMessage mail = new MailMessage();
                String[] addr = txtTo.Text.Split(',');
                try
                {
                    mail.From = new MailAddress("abcdef@gmail.com", "Liên Hệ", System.Text.Encoding.UTF8);
                    Byte i;
                    for (i = 0; i < addr.Length; i++)
                        mail.To.Add(addr[i]);
                    mail.Subject = txtSubject.Text;
                    mail.Body = txtConTent.Text;
                    mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
                    mail.ReplyTo = new MailAddress(txtTo.Text);
                    SmtpServer.Send(mail);
    
                }
                catch (Exception ex) { }
            }
    }
    em cảm ơn nhiều nhiều ạ!

    [=========> Bổ sung bài viết <=========]

    Hic hem ai giúp em à
    Được sửa bởi khongyeu09 lúc 14:56 ngày 01-01-2011 Reason: Bổ sung bài viết
    Quote Quote

Bookmarks

Quy định

  • Bạn không thể tạo chủ đề mới
  • Bạn không thể trả lời bài viết
  • Bạn không thể gửi file đính kèm
  • Bạn không thể sửa bài viết của mình
  •