Click here to Skip to main content
12,556,726 members (69,251 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET Web
Hi everyone,
I want to send numbers (for ex. 1 to 100) to users mail who visit the site and write his/her e-mail address to textbobox. i can send mail. But i have a problem during incresing number. When i run the program , it send number "1" again and again. i'm send mail to abc@... then i'm sending to abcd@... but program send number "1" at each turn, not number 2,3,4,5...

thanks in advance...
Posted 8-Dec-12 8:31am
Zaf Khan 8-Dec-12 16:21pm
You have to post your code so that someone can help you find the issue.
Without it theresnt way of knowing where your going.

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

When user open the main page, he write his name ,surname, mail address... then program will send numbers to users by mail.

protected void btnKatil_Click(object sender, EventArgs e)
    Label1.Text = TextBox1.Text;
    Label2.Text = TextBox2.Text;
    Label3.Text = TextBox3.Text;
    int seatNumber = 1;  //i want to increase this number each time and send mail

    MailMessage mail = new MailMessage();
    mail.From = new MailAddress("");
    mail.Subject = "MailSubject" ;
    mail.Body = "Dear " + TextBox1.Text + " " + TextBox2.Text + " Seat Number : " + seatNumber.ToString();
    mail.IsBodyHtml = true;
    SmtpClient client = new SmtpClient("", 587);
    client.EnableSsl = true;
    NetworkCredential credentials = new NetworkCredential("", "password");
    client.Credentials = credentials;
    catch (Exception hata)
Surendra0x2 9-Dec-12 4:12am
You're Posting Your Question in Wrong section Always use Post a Question widget :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Declare this variable at the class /Page level or maintain it in the session. Because it is getting assigned the value '1' every time btnKatil_Click event is fired.....

int seatNumber = 1;  //move this to outside of event btnKatil_Click

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161026.1 | Last Updated 9 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100