sending mail in contact information with c#.net problem? help please..

Posted by ilkdrl on Stack Overflow See other posts from Stack Overflow or by ilkdrl
Published on 2010-05-20T21:39:54Z Indexed on 2010/05/20 21:40 UTC
Read the original article Hit count: 259

Filed under:
|
   protected void Button2_Click(object sender, EventArgs e)
       {

    string ad = TextBox1.Text;
    string firma = TextBox2.Text;
    string mail = TextBox3.Text;
    string tel = TextBox4.Text;
    string tel2 = TextBox5.Text;
    string fax = TextBox6.Text;
    string fax2 = TextBox7.Text;
    string web = TextBox8.Text;
    string mesaj = TextBox9.Text;

    try 
    {
        string fromAddress = "[email protected]";
        string fromName = "user";
        string toMail = "[email protected]";
        string toNme = "Mr.";
        string msgSubject = "Contact";
        string sifre = "userpassword";

        string msgBody = "you have a message; \n"
        + "\n"
        + "\n"
        + "Mesaji Gönderenin Adi :" + ad + "\n"
        + "Mesaji Gönderen Firma :" + firma + "\n"
        + "Mesaji Gönderenin Maili :" + mail + "\n"
        + "Mesaji Gönderenin Tel. Numarasi :" + tel + tel2 + "\n"
        + "Mesaji Gönderenin Fax Numarasi :" + fax + fax2 + "\n"
        + "Mesaji Gönderenin Web Adresi :" + web + "\n"
        + "\n"
        + "\n"
        + "" + mesaj + ""
        + "\n"
        + "\n"
        + "=======================================" + "\n";

    SmtpClient client = new SmtpClient();
    client.Credentials = new System.Net.NetworkCredential(fromAddress, sifre);
    client.Host = "smtp.gmail.com";
    client.Port = 1772;
    client.EnableSsl = false;
    MailAddress from = new MailAddress(fromAddress, fromName);
    MailAddress to = new MailAddress(toMail, toNme);
    MailMessage message = new MailMessage(from, to);

    message.Subject = msgSubject;
    message.Body = msgBody;

    client.Send(message);
    Response.Redirect("iletisim.aspx");


    }
    catch (Exception ex)
    {
    }

AND WEB.CONFIG

http://go.microsoft.com/fwlink/?LinkId=169433 -->

iam trying to send email but i cant give. Where is my problem. Please help me.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about sendmail