Guest User

Untitled

a guest
Jul 16th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.94 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Net.Mail;
  10. using System.IO;
  11.  
  12. namespace Maplestory_Account_tool
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         public string id; //Maple ID
  22.         public string pw; //Maple Password
  23.         public string pin; //Maple Pin
  24.         public string accemail; //Mail of the Maplestory account
  25.         public string email; //Your email
  26.         public string emailpw; //Password of your email
  27.         public string name; //Your name
  28.         public string lastname; //Your last name
  29.         public string year; //Year of birth
  30.         public string month; // Month of birth
  31.         public string day; //Day of birth
  32.         public string gender; //Your gender
  33.  
  34.         public void WriteHTML()
  35.         {
  36.             //writes the {account name}.html file
  37.             using (StreamWriter writer = new StreamWriter("C:\\maplestoryAccounts/" + id + ".html"))
  38.             {
  39.                 writer.WriteLine("<html>");
  40.                 writer.WriteLine("<body>");
  41.                 writer.WriteLine("<center><h1>Maplestory account : " + id + "</h1></center>");
  42.                 // <Username>
  43.                 writer.WriteLine("<CENTER><table BORDER = 1 WIDTH = 325>");
  44.                 writer.WriteLine("<CENTER><h3>Maplestory ID:<h3></CENTER>");
  45.                 writer.WriteLine("<tr>");
  46.                 writer.WriteLine("<td><CENTER>" + id + "</CENTER></td>");
  47.                 writer.WriteLine("</tr>");
  48.                 // </Username>
  49.                 //-----------------------------------------------------------------
  50.                 // <Password>
  51.                 writer.WriteLine("<CENTER><h3>Password:<h3></CENTER></td>");
  52.                 writer.WriteLine("<tr>");
  53.                 writer.WriteLine("<td><CENTER>" + pw + "</CENTER></td>");
  54.                 writer.WriteLine("</tr>");
  55.                 // </Password>
  56.                 //-----------------------------------------------------------------
  57.                 // <PIN>
  58.                 writer.WriteLine("<CENTER><h3>PIN : <h3></CENTER></td>");
  59.                 writer.WriteLine("<tr>");
  60.                 writer.WriteLine("<td><CENTER>" + pin + "</CENTER></td>");
  61.                 writer.WriteLine("</tr>");
  62.                 // </PIN>
  63.                 //-----------------------------------------------------------------
  64.                 // <Email>
  65.                 writer.WriteLine("<CENTER><h3>Email : <h3></CENTER></td>");
  66.                 writer.WriteLine("<tr>");
  67.                 writer.WriteLine("<td><CENTER>" + accemail + "</CENTER></td>");
  68.                 writer.WriteLine("</tr>");
  69.                 // </Email>
  70.                 //-----------------------------------------------------------------
  71.                 // <First Name>
  72.                 writer.WriteLine("<CENTER><h3>First Name :  <h3></CENTER></td>");
  73.                 writer.WriteLine("<tr>");
  74.                 writer.WriteLine("<td><CENTER>" + name + "</CENTER></td>");
  75.                 writer.WriteLine("</tr>");
  76.                 // </First Name>
  77.                 //-----------------------------------------------------------------
  78.                 // <Last Name>
  79.                 writer.WriteLine("<CENTER><h3>Last Name :  <h3></CENTER></td>");
  80.                 writer.WriteLine("<tr>");
  81.                 writer.WriteLine("<td><CENTER>" + lastname + "</CENTER></td>");
  82.                 writer.WriteLine("</tr>");
  83.                 // </Last Name>
  84.                 //-----------------------------------------------------------------
  85.                 // <Birthday>
  86.                 writer.WriteLine("<CENTER><h3>Birthday <yyyy-mm-dd> : <h3></CENTER></td>");
  87.                 writer.WriteLine("<tr>");
  88.                 writer.WriteLine("<td><CENTER>" + year + "-" + month + "-" + day + "</CENTER></td>");
  89.                 writer.WriteLine("</tr>");
  90.                 // </Birthday>
  91.                 //-----------------------------------------------------------------
  92.                 // <Gender>
  93.                 writer.WriteLine("<CENTER><h3>Gender : <h3></CENTER></td>");
  94.                 writer.WriteLine("<tr>");
  95.                 writer.WriteLine("<td><CENTER>" + gender + "</CENTER></td>");
  96.                 writer.WriteLine("</tr>");
  97.                 // </Gender>
  98.                 writer.WriteLine("</body>");
  99.                 writer.WriteLine("</html>");
  100.             }
  101.         }
  102.  
  103.         private void btnSend_Click(object sender, EventArgs e)
  104.         {
  105.             try
  106.             {
  107.                 // Assigns the values of the textboxes to the variables
  108.                 id = txtID.Text;
  109.                 pw = txtPass.Text;
  110.                 pin = txtPin.Text;
  111.                 email = txtMail.Text;
  112.                 emailpw = txtEmailPass.Text;
  113.                 accemail = txtYourEmail.Text;
  114.                 name = txtName.Text;
  115.                 lastname = txtLastName.Text;
  116.                 year = cmbYear.Text;
  117.                 month = cmbMonth.Text;
  118.                 day = cmbDay.Text;
  119.  
  120.                  // Checks if the directory excists, if yes : Write file
  121.             if (Directory.Exists("C:\\maplestoryAccounts"))
  122.             {
  123.                 MessageBox.Show("File written to C:\\maplestoryAccounts");
  124.                 WriteHTML();
  125.             }
  126.             else
  127.             {
  128.                 // if directory doesn't excist :  Create Directory and write file
  129.                     Directory.CreateDirectory("C:\\maplestoryAccounts");
  130.                     MessageBox.Show("Directory created and file written to C:\\maplestoryAccounts");
  131.                     WriteHTML();
  132.                 }
  133.    
  134.                 MailMessage mail = new MailMessage();
  135.                 SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
  136.                 // it sends the email from itself to itself
  137.                 mail.From = new MailAddress(email);
  138.                 mail.To.Add(email);
  139.                 mail.Subject = "Maplestory account info of : " + txtID.Text;
  140.  
  141.                 mail.IsBodyHtml = true;
  142.                 string htmlBody;
  143.                 // body of the email + HTML
  144.                 htmlBody = ("<html>" +
  145.                 "<body>" +
  146.                 "<center><h1>Maplestory account info : " + id + "</h1></center>" +
  147.                 "<CENTER><table BORDER = 1 WIDTH = 325>" +
  148.                 "<CENTER><h3>Maplestory ID:<h3></CENTER>" +
  149.                 "<tr>" +
  150.                 "<td><CENTER>" + id + "</CENTER></td>" +
  151.                 "</tr>");
  152.  
  153.                 mail.Body = htmlBody;
  154.  
  155.                 System.Net.Mail.Attachment attachment;
  156.                 attachment = new System.Net.Mail.Attachment("C:\\maplestoryAccounts\\" + id + ".html");
  157.                 mail.Attachments.Add(attachment);
  158.  
  159.                 // SMTP Port - 587
  160.                 SmtpServer.Port = 587;
  161.                 // This gets your email and password
  162.                 SmtpServer.Credentials = new System.Net.NetworkCredential(email, emailpw);
  163.                 SmtpServer.EnableSsl = true;
  164.  
  165.                 SmtpServer.Send(mail);
  166.                 MessageBox.Show("The information has been sent to : " + email);
  167.  
  168.             }
  169.             catch (Exception ex)
  170.             {
  171.                 MessageBox.Show(ex.ToString());
  172.             }
  173.         }
  174.  
  175.         private void Form1_Load(object sender, EventArgs e)
  176.         {
  177.             MessageBox.Show("Only GMAIL accounts are supported now" + Environment.NewLine + Environment.NewLine + "Benjamin");
  178.         }
  179.  
  180.         private void radioButton1_CheckedChanged(object sender, EventArgs e)
  181.         {
  182.             //Variable Gender gets the value : "Male"
  183.             gender = "Male";
  184.         }
  185.  
  186.         private void radioButton2_CheckedChanged(object sender, EventArgs e)
  187.         {
  188.             // Variable Gender gets the value : "Female"
  189.             gender = "female";
  190.         }
  191.         }
  192.     }
Add Comment
Please, Sign In to add comment