Things you will need:
C# Programming Language
3 GroupBoxes
2 Labels
2 TextBoxs
1 Button
1 statusStrip1
Make your form look like this:
Ignore the GUI.
Make your statusStrip1 text like this : Idle... [Made By xxx]
Replace the xxx to your desired name.
Make radioButton1 text as Gmail
Make radioButton2 text as Hotmail
Now we want to use some resources. Put this at the top of the code:
[vb]using System.Net.Mail;
using System.Threading;[/vb]
In VB.NET it's Import, but in C#, it's using.
Now we want to make our own function.
Under:
[vb]public Form1()
{
InitializeComponent();
}[/vb]
Put this code:
[vb]private void gmail()
{
try
{
CheckForIllegalCrossThreadCalls = false;
toolStripStatusLabel1.ForeColor = Color.Yellow;
toolStripStatusLabel1.Text = "Checking Email Account...";
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress(textBox1.Text);
mail.To.Add("asfasf@hotmail.com");
mail.Subject = "Testing";
mail.Body = "Testing";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential(textBox1.Text, textBox2.Text);
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
toolStripStatusLabel1.Text = "Email Account Working!";
toolStripStatusLabel1.ForeColor = Color.Lime;
groupBox1.Enabled = true;
groupBox2.Enabled = true;
groupBox3.Enabled = true;
}
catch
{
toolStripStatusLabel1.Text = "Email Account Not Working!";
toolStripStatusLabel1.ForeColor = Color.Red;
groupBox1.Enabled = true;
groupBox2.Enabled = true;
groupBox3.Enabled = true;
}
}[/vb]
That's going to try to email asfasf@hotmail.com using the gmail account that the user inputted in the textboxes. If it emails successfully, the gmail account is working. If there's a error, the gmail account is not working. To catch errors, it's using try catch.
Now for the hotmail function, add this code underneath that gmail code we did:
[vb]private void hotmail()
{
try
{
CheckForIllegalCrossThreadCalls = false;
toolStripStatusLabel1.ForeColor = Color.Yellow;
toolStripStatusLabel1.Text = "Checking Email Account...";
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.live.com");
mail.From = new MailAddress(textBox1.Text);
mail.To.Add("asfasf@hotmail.com");
mail.Subject = "Testing";
mail.Body = "Testing";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential(textBox1.Text, textBox2.Text);
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
toolStripStatusLabel1.Text = "Email Account Working!";
toolStripStatusLabel1.ForeColor = Color.Lime;
groupBox1.Enabled = true;
groupBox2.Enabled = true;
groupBox3.Enabled = true;
}
catch
{
toolStripStatusLabel1.Text = "Email Account Not Working!";
toolStripStatusLabel1.ForeColor = Color.Red;
groupPanel1.Enabled = true;
groupPanel2.Enabled = true;
groupPanel3.Enabled = true;
}
}[/vb]
It's doing the same method as the gmail check function, but it's using the hotmail account that the user inputted.
Now add this code to the button:
[vb]if (radioButton1.Checked == true)
{
groupBox1.Enabled = false;
groupBox2.Enabled = false;
groupBox3.Enabled = false;
Thread t = new Thread(new ThreadStart(gmail));
t.IsBackground = true;
t.Start();
}
else if (radioButton2.Checked == true)
{
groupBox1.Enabled = false;
groupBox2.Enabled = false;
groupBox3.Enabled = false;
Thread t = new Thread(new ThreadStart(hotmail));
t.IsBackground = true;
t.Start();
}[/vb]
What is this is doing is that if radioButton1 is checked which is Gmail, it will start a new multi-threading of the function gmail. If radioButton2 is checked which is Hotmail, it will start a new multi-threading of the function hotmail.
That's all! Hope your enjoy my tutorial. All credits go to me. Cya!
C# Programming Language
3 GroupBoxes
2 Labels
2 TextBoxs
1 Button
1 statusStrip1
Make your form look like this:
Ignore the GUI.
Make your statusStrip1 text like this : Idle... [Made By xxx]
Replace the xxx to your desired name.
Make radioButton1 text as Gmail
Make radioButton2 text as Hotmail
Now we want to use some resources. Put this at the top of the code:
[vb]using System.Net.Mail;
using System.Threading;[/vb]
In VB.NET it's Import, but in C#, it's using.
Now we want to make our own function.
Under:
[vb]public Form1()
{
InitializeComponent();
}[/vb]
Put this code:
[vb]private void gmail()
{
try
{
CheckForIllegalCrossThreadCalls = false;
toolStripStatusLabel1.ForeColor = Color.Yellow;
toolStripStatusLabel1.Text = "Checking Email Account...";
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress(textBox1.Text);
mail.To.Add("asfasf@hotmail.com");
mail.Subject = "Testing";
mail.Body = "Testing";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential(textBox1.Text, textBox2.Text);
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
toolStripStatusLabel1.Text = "Email Account Working!";
toolStripStatusLabel1.ForeColor = Color.Lime;
groupBox1.Enabled = true;
groupBox2.Enabled = true;
groupBox3.Enabled = true;
}
catch
{
toolStripStatusLabel1.Text = "Email Account Not Working!";
toolStripStatusLabel1.ForeColor = Color.Red;
groupBox1.Enabled = true;
groupBox2.Enabled = true;
groupBox3.Enabled = true;
}
}[/vb]
That's going to try to email asfasf@hotmail.com using the gmail account that the user inputted in the textboxes. If it emails successfully, the gmail account is working. If there's a error, the gmail account is not working. To catch errors, it's using try catch.
Now for the hotmail function, add this code underneath that gmail code we did:
[vb]private void hotmail()
{
try
{
CheckForIllegalCrossThreadCalls = false;
toolStripStatusLabel1.ForeColor = Color.Yellow;
toolStripStatusLabel1.Text = "Checking Email Account...";
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.live.com");
mail.From = new MailAddress(textBox1.Text);
mail.To.Add("asfasf@hotmail.com");
mail.Subject = "Testing";
mail.Body = "Testing";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential(textBox1.Text, textBox2.Text);
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
toolStripStatusLabel1.Text = "Email Account Working!";
toolStripStatusLabel1.ForeColor = Color.Lime;
groupBox1.Enabled = true;
groupBox2.Enabled = true;
groupBox3.Enabled = true;
}
catch
{
toolStripStatusLabel1.Text = "Email Account Not Working!";
toolStripStatusLabel1.ForeColor = Color.Red;
groupPanel1.Enabled = true;
groupPanel2.Enabled = true;
groupPanel3.Enabled = true;
}
}[/vb]
It's doing the same method as the gmail check function, but it's using the hotmail account that the user inputted.
Now add this code to the button:
[vb]if (radioButton1.Checked == true)
{
groupBox1.Enabled = false;
groupBox2.Enabled = false;
groupBox3.Enabled = false;
Thread t = new Thread(new ThreadStart(gmail));
t.IsBackground = true;
t.Start();
}
else if (radioButton2.Checked == true)
{
groupBox1.Enabled = false;
groupBox2.Enabled = false;
groupBox3.Enabled = false;
Thread t = new Thread(new ThreadStart(hotmail));
t.IsBackground = true;
t.Start();
}[/vb]
What is this is doing is that if radioButton1 is checked which is Gmail, it will start a new multi-threading of the function gmail. If radioButton2 is checked which is Hotmail, it will start a new multi-threading of the function hotmail.
That's all! Hope your enjoy my tutorial. All credits go to me. Cya!