예제 #1
0
        public MessageLabel(User user)
        {
            this.user = user;
            InitializeComponent();
            try
            {
                mailRepository = new MailRepository(
                    "imap.gmail.com",
                    993,
                    true,
                    user.Email,
                    user.Password
                    );

                emailList = mailRepository.GetAllMails("inbox");
                mailbox   = new MailBox(emailList);
                mailbox.Serialize();
            }
            catch (System.Net.Sockets.SocketException)
            {
                mailbox   = MailBox.Deserialize();
                emailList = mailbox.emailList;
            }


            ListViewInit();
            PopulateListView(emailList);
            InitWorker();
            timer1.Enabled = true;
        }
예제 #2
0
 private void btnSignIn_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(txtEmail.Text) || string.IsNullOrWhiteSpace(txtPassword.Text))
     {
         MessageBox.Show("Email or password field cannot be empty!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         if (rememberCheckBox.Checked)
         {
             DataService.SerializeLoginData(txtEmail.Text, txtPassword.Text);
         }
         {
             MailRepository mailRepository = new MailRepository("imap.gmail.com", 993, true, new UserData(txtEmail.Text, txtPassword.Text));
             if (mailRepository.IsLoginSuccessfullyAuth())
             {
                 new MainForm(mailRepository).Show();
                 Hide();
             }
             else
             {
                 System.Windows.Forms.MessageBox.Show("Authentication error - Please double check email and password fields.", "Authentication error!", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
 }
예제 #3
0
 public NewMailForm(UserData userData, bool isReply, bool isFwd, [Optional] MailInfo originalMail)
 {
     InitializeComponent();
     mailRepository    = new MailRepository("smtp.gmail.com", 465, true, userData);
     textBoxes         = new MetroFramework.Controls.MetroTextBox[] { txtSubject, txtTo, txtNewMail, txtCc, txtBcc };
     this.originalMail = originalMail;
     this.isReply      = isReply;
     this.isFwd        = isFwd;
 }
예제 #4
0
 public MainForm(MailRepository mailRepository)
 {
     InitializeComponent();
     this.mailRepository           = mailRepository;
     this.mailRepository.MaxEmails = defaultMax;
     this.mailRepository.DateFrom  = defaultDate;
     refreshTimer.Interval         = 600000;
     emailButtons = new FontAwesome.Sharp.IconButton[] { btnReply, btnReplyAll, btnFwd, btnMarkUnread, btnStar };
 }
예제 #5
0
        private void SendBtn_Click(object sender, EventArgs e)
        {
            if (ReceiverTxt.Text == "" || SubjectTxt.Text == "" || MessageTxt.Text == "")
            {
                MessageBox.Show("Please fill the text areas!", "Error");
                return;
            }
            string to      = ReceiverTxt.Text;
            string subject = SubjectTxt.Text;
            string body    = MessageTxt.Text;

            MailRepository.QuickSend(user.Email, to, subject, body, user.Email, user.Password);
            ReceiverTxt.Text = "";
            SubjectTxt.Text  = "";
            MessageTxt.Text  = "";
        }