Exemple #1
0
 private void Gmail_Load(object sender, EventArgs e)
 {
     if (Reply == true)
     {
         Title.Text     = "Reply Message";
         PanelTo.Height = 0;
         PanelTo.Hide();
         SendTo.Text         = ToX;
         PanelSubject.Height = 0;
         PanelSubject.Hide();
         Subject.Text  = SubjectX;
         BOXATT.Height = 82;
     }
     else
     {
         SendTo.Text = Operations.GlobalVarriable.SendToChoosedAddress;
         Operations.GlobalVarriable.SendToChoosedAddress = string.Empty;
     }
     System.Threading.Thread Ad = new System.Threading.Thread(new System.Threading.ThreadStart(AddCollection));
     Ad.Start();
     CryptType.SelectedIndex = 0;
     // AES 1
     // DES 2
     // TwoFish 3
     // BlowFish 4
     BOXATT.Hide();
     TurnOnUsePass.Value = true;
     SendBT.Enabled      = false;
 }
Exemple #2
0
        private void Attachment_Click(object sender, EventArgs e)
        {
            // renew
            Send.Att.Clear();
            FileNameShow.Text = "";
            BOXATT.Hide();
            // Create and show choosen box
            OpenFileDialog filedialog = new OpenFileDialog();

            filedialog.AutoUpgradeEnabled = true;
            filedialog.CheckFileExists    = true;
            filedialog.CheckPathExists    = true;
            filedialog.Multiselect        = true;
            filedialog.Title = ProgramInfo.App.Name + " " + ProgramInfo.App.Version;
            filedialog.ShowDialog();
            #region File types you can't include as attachments
            // https://support.google.com/mail/answer/6590?hl=en
            string BlockedFileType = ".ADE .ADP .BAT .CHM .CMD .COM .CPL .EXE .HTA .INS .ISP .JAR .JS .JSE .LIB .LNK .MDE .MSC .MSI .MSP .MST .NSH .PIF .SCR .SCT .SHB .SYS .VB .VBE .VBS .VXD .WSC .WSF .WSH";
            #endregion
            string Error = string.Empty;
            if (filedialog.FileNames.Length < 1)
            {
                return;
            }
            else
            {
                foreach (var file in filedialog.FileNames)
                {
                    FileInfo FF = new FileInfo(file);
                    if (FF.Attributes == FileAttributes.Directory)
                    {
                        Error += "\r\nYou can NOT attachment " + Path.GetDirectoryName(file) + "! Because it is folder! Please try Compress it before select!";
                        continue;
                    }
                    if (FF.Length > Operations.GlobalVarriable.MaxAttachmentSize)
                    {
                        Error += "\r\nYou can NOT attachment " + Path.GetFileName(file) + "! Because it large than " + ((Operations.GlobalVarriable.MaxAttachmentSize / 1024) / 1024) + " MB!";
                        continue;
                    }
                    if (BlockedFileType.IndexOf(Path.GetExtension(file).ToUpper()) != -1)
                    {
                        Error += "\r\nYou can NOT send " + Path.GetFileName(file) + " via Gmail!";
                        continue;
                    }
                    FileNameShow.Text += Path.GetFileName(file).ToUpper() + "\t";
                    Send.Att.Add(file);
                }
            }
            __COUNT.Text = "SELECTED " + Send.Att.Count + " FILE(S)";
            if (Error != String.Empty)
            {
                MessageBox.Show(Error, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (Send.Att.Count > 0)
            {
                BOXATT.Show();
            }
        }