private void SendMailPopup() { var regex = new Regex(@"^(([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))@" + @"((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]? [0-9]{1,2}|25[0-5]|2[0-4][0-9])\." + @"([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]? [0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|" + @"([a-zA-Z]+[\w-]+\.)+[a-zA-Z]{2,4})$"); string subject; if (!String.IsNullOrEmpty(textBoxEmail.Text) && regex.IsMatch(textBoxEmail.Text)) { subject = string.Format("{0} {1} Crash Report by {2}", _appTitle, _appVersion, textBoxEmail.Text); } else { subject = string.Format("{0} {1} Crash Report", _appTitle, _appVersion); } var mapi = new MAPI(); mapi.AddRecipientTo(_toAddress.Address); if (File.Exists(string.Format("{0}\\{1}CrashScreenshot.png", Path.GetTempPath(), _appTitle)) && checkBoxIncludeScreenshot.Checked) { mapi.AddAttachment(string.Format("{0}\\{1}CrashScreenshot.png", Path.GetTempPath(), _appTitle)); } mapi.SendMailPopup(subject, HtmlReport()); }
private void btnSend_Click(object sender, EventArgs e) { string to = txtEmail.Text; string subject = txtSubject.Text; string body = txtMessage.Text; MAPI mapi = new MAPI(); foreach (string filename in mAttachments) { mapi.AddAttachment(filename); } mapi.AddRecipientTo(to); string error; mapi.SendMailPopup(subject, body, out error); if (!error.Equals("")) { MessageBox.Show(error); DialogResult = DialogResult.None; return; } DialogResult = DialogResult.OK; }
private void toolButtonEmail_Click(object sender, EventArgs e) { MAPI mapi = new MAPI(); mapi.AddAttachment(mSelectedVoiceMailEntry.FullPath); mapi.SendMailPopup("FW: Voicemail from " + mSelectedVoiceMailEntry.Info.From, "FW: Voicemail from " + mSelectedVoiceMailEntry.Info.From); }
private void emailToolStripMenuItem_Click(object sender, EventArgs e) { frmEMail frm = new frmEMail(); frm.ShowDialog(); string stEMail = frm.GetEMail(); if (frm.DialogResult == DialogResult.Cancel) { return; } if (File.Exists("c:\\send.jpg")) { File.Delete("c:\\send.jpg"); } File.Copy(m_ImageFilePath, "c:\\send.jpg"); MAPI mapi = new MAPI(); // mapi.AddAttachment(m_ImageFilePath); mapi.AddAttachment("c:\\send.jpg"); mapi.AddRecipientTo(stEMail); mapi.SendMailPopup("My Subject", "body text"); }
private void sendToMailMenuItem6_Click(object sender, EventArgs e) { if (_fileName.Length >= 1) { var mapi = new MAPI(); mapi.AddAttachment(_fileName); mapi.SendMailPopup(string.Empty, _fileName); } }
//################################################################################################ // PDF Export public void Export_PDF() { try { // MessageBox.Show(sDirPDF); // Path of the selected Eplan project sProject = Get_Project(); if (sProject == "") { return; } // Name of the Eplan project sProjectName = Get_Name(sProject); // PDF - Export file name / path sFileExport = sDirPDF + sProjectName + ".pdf"; //MessageBox.Show("Pfad : " + sFileExport); Eplan.EplApi.ApplicationFramework.ActionCallingContext aPDF = new Eplan.EplApi.ApplicationFramework.ActionCallingContext(); aPDF.AddParameter("TYPE", "PDFPROJECTSCHEME"); aPDF.AddParameter("PROJECTNAME", sProject); aPDF.AddParameter("EXPORTFILE", sFileExport); //aPDF.AddParameter("EXPORTSCHEME", "Standard"); // Optional - enter here your EPLAN Export Scheme instead of "Standard" aPDF.AddParameter("BLACKWHITE", "1"); // PDF Print as Black & White Eplan.EplApi.ApplicationFramework.CommandLineInterpreter aEx = new Eplan.EplApi.ApplicationFramework.CommandLineInterpreter(); bool sRet = aEx.Execute("export", aPDF); if (!sRet) { System.Windows.Forms.MessageBox.Show("ERROR : PDF EXPORT"); } string SUBJECT = "Eplan Schematic : " + sProjectName; string BODY = "Original file path : " + sFileExport; string ATTACH = sFileExport; MAPI mapi = new MAPI(); // Definition email adresse / Optional //string ADDRESS = "YourEmail@...."; //mapi.AddRecipientTo(ADDRESS); //string ADDRESS2 = "YourEmail@...."; //mapi.AddRecipientTo(ADDRESS2); if (File.Exists(ATTACH)) { mapi.AddAttachment(ATTACH); } mapi.SendMailPopup(SUBJECT, BODY); // show E-mail before sending // mapi.SendMailDirect(SUBJECT, BODY); // or send E-mail directly } catch { return; } }
public void Execute(string filename) { if (string.IsNullOrEmpty(filename)) { return; } var mapi = new MAPI(); _fileName = filename; mapi.AddAttachment(filename); mapi.SendMailPopup(string.Empty, filename); }
private void btnSend_Click(object sender, EventArgs e) { MAPI mapi = new MAPI(); mapi.AddAttachment("c:\\temp\\file1.txt"); mapi.AddAttachment("c:\\temp\\file2.txt"); mapi.AddRecipientTo("*****@*****.**"); mapi.AddRecipientTo("*****@*****.**"); mapi.SendMailPopup("testing", "body text"); // Or if you want try and do a direct send without displaying the // mail dialog mapi.SendMailDirect("testing", "body text"); }
public void Function(string ADDRESS,string SUBJECT, string BODY,string ATTACH) { MAPI mapi = new MAPI(); mapi.AddRecipientTo(ADDRESS); if (File.Exists(ATTACH)) { mapi.AddAttachment(ATTACH); } mapi.SendMailPopup(SUBJECT, BODY); // E-mail anzeigen //mapi.SendMailDirect(SUBJECT, BODY); //E-mail direkt versenden return; }
public void Function(string ADDRESS, string SUBJECT, string BODY, string ATTACH) { MAPI mapi = new MAPI(); mapi.AddRecipientTo(ADDRESS); if (File.Exists(ATTACH)) { mapi.AddAttachment(ATTACH); } mapi.SendMailPopup(SUBJECT, BODY); // E-mail anzeigen //mapi.SendMailDirect(SUBJECT, BODY); //E-mail direkt versenden return; }
public void emailFeatureRequest() { try { MAPI m = new MAPI(); m.AddRecipientTo("*****@*****.**"); String subject = "[LevelEditor] New feature request"; String body = "\r\r\n"; body += getPublicSignature(); m.SendMailPopup(subject, body); } catch (Exception) { MessageBox.Show("Hmmm... Something bad happened...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void emailToDevelopers() { try { MAPI m = new MAPI(); m.AddAttachment(logfilename); m.AddRecipientTo("*****@*****.**"); String subject = "[LevelEditor] Please review my error log"; String body = ""; body += getPublicSignature(); m.SendMailPopup(subject, body); } catch (Exception) { MessageBox.Show("Hmmm... Something bad happened...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Invokes the default email client and prepoluates the fields from message. /// </summary> /// <param name="message">The message to prepopulate with.</param> /// <author>Jurie.smit</author> /// <datetime>2013/01/14-09:10 AM</datetime> public void SendCommunication(T message) { //Dev2Logger.Log.Debug(); MAPI mapi = new MAPI(); mapi.AddRecipientTo(message.To); if (!String.IsNullOrEmpty(message.AttachmentLocation)) { if (message.AttachmentLocation.Contains(";")) { var attachmentList = message.AttachmentLocation.Split(';'); attachmentList.ForEach(mapi.AddAttachment); } else { mapi.AddAttachment(@message.AttachmentLocation); } } mapi.SendMailPopup(message.Subject, message.Content); }
private void ZZ_Click(object sender, EventArgs e) { if (NR.Text != "" && NF.Text != "") { String Line = ""; String[] pobrane; Int32 i = 0; Double help = 0; if (File.Exists(Filename)) { StreamReader Zam = new StreamReader(Filename); List <String> Poz = new List <string>(); List <Double> ilości = new List <Double>(); if (change) { Zam.Close(); Zam = new StreamReader(Filename); while (Zam.EndOfStream == false) { Line = Zam.ReadLine(); pobrane = Line.Split(';'); if (Double.TryParse(pobrane[1], out help)) { if (help % 1 != 0) { help += 0.5; } Poz.Add(pobrane[0]); ilości.Add(help); i++; } } Zam.Close(); Boolean mm = false; Boolean test2 = false; for (Int32 a = 0; a < Poz.Count; a++) { if (ilości[a] > 0) { for (Int32 b = a + 1; b < Poz.Count; b++) { if (Poz[a] == Poz[b]) { ilości[a] += ilości[b]; ilości[b] = 0; } if (Poz[a] == "01.21FA000 V1" || Poz[a] == "01.23KA000 V1") { test2 = true; } } } } Boolean ww = false; if (test2) { for (Int32 a = 0; a < Poz.Count; a++) { if (Poz[a] == "02.Z10NE030E V1" || Poz[a] == "02.Z10V100E.01 V1" || Poz[a] == "02.Z10K800AE V1" || Poz[a] == "02.Z10NG120 V1" || Poz[a] == "02.Z10M200E V1") { mm = true; ilości[a] += 1; } else { mm = true; ww = true; } } } if (mm) { if (MessageBox.Show("W twoim zamówieniu znajdują się jednostki napędu SERVO-DRIVE do podnośników, więc dołączyliśmy jeden zasilacz z kompletem przewodów\n do zasilenia wszystkich urządzeń SERVO-DRIVE w podnośnikach w jednej kuchni.\n Jeżeli to ci wystarczy kliknij \"OK\", a jeżeli potrzebujesz więcej\n naciśnij \"Anuluj\" i poinformuj nas o tym w uwagach.", "SERVO-DRIVE do AVENTOS", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { string pom; string pom2; if (DateTime.Now.Month < 10) { pom = "0" + DateTime.Now.Month; } else { pom = DateTime.Now.Month.ToString(); } if (DateTime.Now.Day < 10) { pom2 = "0" + DateTime.Now.Day; } else { pom2 = DateTime.Now.Day.ToString(); } string sup = ""; Boolean test = false; char[] znaki = Path.GetInvalidFileNameChars(); for (Int32 w = 0; w < NR.TextLength; w++) { for (Int32 m = 0; m < znaki.Length; m++) { if (NR.Text[w] == znaki[m]) { test = true; break; } else { test = false; } } if (test) { sup += " "; } else { sup += NR.Text[w]; } } string zapis = "Zamówienie " + NF.Text + " " + DateTime.Now.Year + "." + pom + "." + pom2 + " " + sup; zamowienie.FileName = zapis; zamowienie.Filter = "Archiwum zip (.zip)|*.zip"; if (zamowienie.ShowDialog() == DialogResult.OK) { //try { Blum_Konfigurator.Properties.Settings.Default.Numer = Blum_Konfigurator.Properties.Settings.Default.Numer + 1; Blum_Konfigurator.Properties.Settings.Default.Save(); Filename = zamowienie.FileName; String folder = System.IO.Path.GetDirectoryName(zamowienie.FileName) + ".txt"; System.IO.Directory.CreateDirectory(Foldername); folder = Foldername + "\\" + System.IO.Path.GetFileNameWithoutExtension(zamowienie.FileName) + " - INDEX.txt"; string rap = "C:\\Users\\" + Environment.UserName + "\\folder_temp\\" + System.IO.Path.GetFileNameWithoutExtension(zamowienie.FileName) + " - Zestawienie.txt"; StreamReader temp = new StreamReader(Filename4); StreamWriter zap = new StreamWriter(rap, false); zap.WriteLine("Nazwa firmy: " + NF.Text); zap.WriteLine("Nr/nazwa zamówienia: " + NR.Text); zap.WriteLine("Termin realizacji: " + DataREa.Value.Day.ToString() + "." + DataREa.Value.Month.ToString() + "." + DataREa.Value.Year.ToString()); zap.Write(temp.ReadToEnd()); zap.WriteLine("Uwagi ogólne:"); if (Uwag.Text.Length > 0) { zap.WriteLine(Uwag.Text); } else { zap.WriteLine("Brak.\n"); } zap.WriteLine(toBin(Blum_Konfigurator.Properties.Settings.Default.Numer)); zap.Close(); temp.Close(); StreamWriter zapisujemy = new StreamWriter(folder, false); zapisujemy.WriteLine("Element;Ilość"); for (Int32 a = 0; a < Poz.Count; a++) { if (ilości[a] > 0) { zapisujemy.WriteLine(String.Format("{0};{1}", Poz[a], ilości[a])); } } if (ww) { zapisujemy.WriteLine(String.Format("02.Z10NE030E V1;1")); zapisujemy.WriteLine(String.Format("02.Z10V100E.01 V1;1")); zapisujemy.WriteLine(String.Format("02.Z10K800AE V1;1")); zapisujemy.WriteLine(String.Format("02.Z10NG120 V1;1")); zapisujemy.WriteLine(String.Format("02.Z10M200E V1;1")); } zapisujemy.Close(); folder = Foldername + "\\" + System.IO.Path.GetFileNameWithoutExtension(zamowienie.FileName) + " - Uwagi.txt"; StreamReader uwagi = new StreamReader(Filename2); String uwaga = uwagi.ReadToEnd(); uwagi.Close(); zapisujemy = new StreamWriter(folder); zapisujemy.WriteLine(NF.Text + "\n" + NR.Text + "\nTermin realizacji: " + DataREa.Value.Day.ToString() + "." + DataREa.Value.Month.ToString() + "." + DataREa.Value.Year.ToString()); zapisujemy.Write(uwaga); zapisujemy.WriteLine("Uwagi ogólne:"); if (Uwag.Text.Length > 0) { zapisujemy.WriteLine(Uwag.Text); } else { zapisujemy.WriteLine("Brak.\n"); } zapisujemy.Close(); if (File.Exists(Filename3)) { File.Move(Filename3, Foldername + "\\" + System.IO.Path.GetFileNameWithoutExtension(zamowienie.FileName) + " - Zobal.txt"); } String zip = System.IO.Path.GetDirectoryName(zamowienie.FileName) + "\\" + System.IO.Path.GetFileNameWithoutExtension(zamowienie.FileName) + ".zip"; if (File.Exists(zamowienie.FileName)) { File.Delete(zamowienie.FileName); } System.IO.Compression.ZipFile.CreateFromDirectory(Foldername, zamowienie.FileName); System.IO.Directory.Delete(Foldername, true); Save = true; change = false; if (MessageBox.Show("Czy wysłać zamówienie wiadomością e-mail?", "Wysyłanie zamówienia", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { MAPI mapi = new MAPI(); mapi.AddAttachment(zamowienie.FileName); mapi.AddRecipientTo("*****@*****.**"); mapi.SendMailPopup(Path.GetFileNameWithoutExtension(zamowienie.FileName), ""); } if (MessageBox.Show("Czy chcesz rozpocząć nowe zamówienie?", "Czy zacząć zamówienie?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { this.Close(); } else { if (File.Exists("C:\\Users\\" + Environment.UserName + "\\zamowienie_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\zamowienie_temp.txt"); } if (File.Exists("C:\\Users\\" + Environment.UserName + "\\uwagi_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\uwagi_temp.txt"); } if (File.Exists("C:\\Users\\" + Environment.UserName + "\\uchwyty_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\uchwyty_temp.txt"); } if (File.Exists("C:\\Users\\" + Environment.UserName + "\\raport_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\raport_temp.txt"); } if (Directory.Exists("C:\\Users\\" + Environment.UserName + "\\folder_temp")) { Directory.Delete("C:\\Users\\" + Environment.UserName + "\\folder_temp", true); } if (File.Exists(Filename)) { StreamWriter czysc = new StreamWriter(Filename); czysc.Close(); } if (File.Exists(Filename2)) { StreamWriter czysc = new StreamWriter(Filename2); czysc.Close(); } NR.Text = ""; Uwag.Text = ""; Save = false; if (new Start().ShowDialog() == DialogResult.OK) { NR.Text = Program.Nazwa; if (File.Exists("C:\\Users\\" + Environment.UserName + "\\zamowienie_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\zamowienie_temp.txt"); } if (File.Exists("C:\\Users\\" + Environment.UserName + "\\uwagi_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\uwagi_temp.txt"); } if (File.Exists("C:\\Users\\" + Environment.UserName + "\\uchwyty_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\uchwyty_temp.txt"); } if (File.Exists("C:\\Users\\" + Environment.UserName + "\\raport_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\raport_temp.txt"); } if (Directory.Exists("C:\\Users\\" + Environment.UserName + "\\folder_temp")) { Directory.Delete("C:\\Users\\" + Environment.UserName + "\\folder_temp", true); } Filename = "C:\\Users\\" + Environment.UserName + "\\zamowienie_temp.txt"; StreamWriter czysc = new StreamWriter(Filename); czysc.Close(); czysc = new StreamWriter(Filename2); czysc.Close(); } else { this.Close(); } } } // catch { //MessageBox.Show("Podczas zapisywania wystąpił błąd!", "Błąd podczas zapisywania", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } else { string pom, pom2; if (DateTime.Now.Month < 10) { pom = "0" + DateTime.Now.Month; } else { pom = DateTime.Now.Month.ToString(); } if (DateTime.Now.Day < 10) { pom2 = "0" + DateTime.Now.Day; } else { pom2 = DateTime.Now.Day.ToString(); } string sup = ""; Boolean test = false; char[] znaki = Path.GetInvalidFileNameChars(); for (Int32 w = 0; w < NR.TextLength; w++) { for (Int32 m = 0; m < znaki.Length; m++) { if (NR.Text[w] == znaki[m]) { test = true; break; } else { test = false; } } if (test) { sup += " "; } else { sup += NR.Text[w]; } } string zapis = "Zamówienie " + NF.Text + " " + DateTime.Now.Year + "." + pom + "." + pom2 + " " + sup; zamowienie.FileName = zapis; zamowienie.Filter = "Archiwum zip (.zip)|*.zip"; if (zamowienie.ShowDialog() == DialogResult.OK) { // try { Blum_Konfigurator.Properties.Settings.Default.Numer = Blum_Konfigurator.Properties.Settings.Default.Numer + 1; Blum_Konfigurator.Properties.Settings.Default.Save(); Filename = zamowienie.FileName; String folder = System.IO.Path.GetDirectoryName(zamowienie.FileName); System.IO.Directory.CreateDirectory(Foldername); folder = Foldername + "\\" + System.IO.Path.GetFileNameWithoutExtension(zamowienie.FileName) + " - INDEX.txt"; string rap = "C:\\Users\\" + Environment.UserName + "\\folder_temp\\" + System.IO.Path.GetFileNameWithoutExtension(zamowienie.FileName) + " - Zestawienie.txt"; StreamReader temp = new StreamReader(Filename4); StreamWriter zap = new StreamWriter(rap, false); zap.WriteLine("Nazwa firmy: " + NF.Text); zap.WriteLine("Nr/nazwa zamówienia: " + NR.Text); zap.WriteLine("Termin realizacji: " + DataREa.Value.Day.ToString() + "." + DataREa.Value.Month.ToString() + "." + DataREa.Value.Year.ToString()); zap.Write(temp.ReadToEnd()); zap.Write(temp.ReadToEnd()); zap.WriteLine("Uwagi ogólne:"); if (Uwag.Text.Length > 0) { zap.WriteLine(Uwag.Text); } else { zap.WriteLine("Brak.\n"); } zap.WriteLine(toBin(Blum_Konfigurator.Properties.Settings.Default.Numer)); zap.Close(); temp.Close(); StreamWriter zapisujemy = new StreamWriter(folder, false); zapisujemy.WriteLine("Element;Ilość"); for (Int32 a = 0; a < Poz.Count; a++) { if (ilości[a] > 0) { zapisujemy.WriteLine(String.Format("{0};{1}", Poz[a], ilości[a])); } } zapisujemy.Close(); folder = Foldername + "\\" + System.IO.Path.GetFileNameWithoutExtension(zamowienie.FileName) + " - Uwagi.txt"; StreamReader uwagi = new StreamReader(Filename2); String uwaga = uwagi.ReadToEnd(); uwagi.Close(); zapisujemy = new StreamWriter(folder); zapisujemy.WriteLine(NF.Text + "\n" + NR.Text + "\nTermin realizacji: " + DataREa.Value.Day.ToString() + "." + DataREa.Value.Month.ToString() + "." + DataREa.Value.Year.ToString()); zapisujemy.Write(uwaga); zapisujemy.WriteLine("Uwagi ogólne:"); zapisujemy.Write(Uwag.Text); zapisujemy.Close(); if (File.Exists(Filename3)) { File.Move(Filename3, Foldername + "\\" + System.IO.Path.GetFileNameWithoutExtension(zamowienie.FileName) + " - Zobal.txt"); } String zip = System.IO.Path.GetDirectoryName(zamowienie.FileName) + "\\" + System.IO.Path.GetFileNameWithoutExtension(zamowienie.FileName) + ".zip"; if (File.Exists(zamowienie.FileName)) { File.Delete(zamowienie.FileName); } System.IO.Compression.ZipFile.CreateFromDirectory(Foldername, zamowienie.FileName); System.IO.Directory.Delete(Foldername, true); Save = true; change = false; try { if (MessageBox.Show("Czy wysłać zamówienie wiadomością e-mail?", "Wysyłanie zamówienia", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { MAPI mapi = new MAPI(); mapi.AddAttachment(zamowienie.FileName); mapi.AddRecipientTo("*****@*****.**"); mapi.SendMailPopup(Path.GetFileNameWithoutExtension(zamowienie.FileName), ""); } } catch { } if (MessageBox.Show("Czy chcesz rozpocząć nowe zamówienie?", "Czy zacząć zamówienie?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { this.Close(); } else { if (File.Exists("C:\\Users\\" + Environment.UserName + "\\zamowienie_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\zamowienie_temp.txt"); } if (File.Exists("C:\\Users\\" + Environment.UserName + "\\uwagi_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\uwagi_temp.txt"); } if (File.Exists("C:\\Users\\" + Environment.UserName + "\\uchwyty_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\uchwyty_temp.txt"); } if (File.Exists("C:\\Users\\" + Environment.UserName + "\\raport_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\raport_temp.txt"); } if (Directory.Exists("C:\\Users\\" + Environment.UserName + "\\folder_temp")) { Directory.Delete("C:\\Users\\" + Environment.UserName + "\\folder_temp", true); } NR.Text = ""; Uwag.Text = ""; Save = false; if (new Start().ShowDialog() == DialogResult.OK) { NR.Text = Program.Nazwa; if (File.Exists("C:\\Users\\" + Environment.UserName + "\\zamowienie_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\zamowienie_temp.txt"); } if (File.Exists("C:\\Users\\" + Environment.UserName + "\\uwagi_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\uwagi_temp.txt"); } if (File.Exists("C:\\Users\\" + Environment.UserName + "\\uchwyty_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\uchwyty_temp.txt"); } if (File.Exists("C:\\Users\\" + Environment.UserName + "\\raport_temp.txt")) { File.Delete("C:\\Users\\" + Environment.UserName + "\\raport_temp.txt"); } if (Directory.Exists("C:\\Users\\" + Environment.UserName + "\\folder_temp")) { Directory.Delete("C:\\Users\\" + Environment.UserName + "\\folder_temp", true); } Filename = "C:\\Users\\" + Environment.UserName + "\\zamowienie_temp.txt"; StreamWriter czysc = new StreamWriter(Filename); czysc.Close(); Filename = "C:\\Users\\" + Environment.UserName + "\\zamowienie_temp.txt"; czysc = new StreamWriter(Filename2); czysc.Close(); } else { this.Close(); } } } //catch { // MessageBox.Show("Podczas zapisywania wystąpił błąd!", "Błąd podczas zapisywania", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } else { MessageBox.Show("Próbujesz zapisać puste zamówienie.", "Puste zamówienie", MessageBoxButtons.OK, MessageBoxIcon.Information); Zam.Close(); } } else { MessageBox.Show("Próbujesz zapisać puste zamówienie.", "Puste zamówienie", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Aby zapisać uzupełnij pola:\n-Nazwa zamawiającego\n-Nr\\nazwa zamówienia.", "Brak informacji", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Launch(Form parentForm, ProjectInfo projectInfo) { string dest = Path.Combine(Path.GetTempPath(), projectInfo.Name + "_wesay.zip"); BackupMaker.BackupToExternal(projectInfo.PathToTopLevelDirectory, dest, projectInfo.FilesBelongingToProject); MAPI msg = new MAPI(); msg.AddAttachment(dest); msg.AddRecipientTo(_settings.Email); subject = String.Format( StringCatalog.Get("{0} WeSay Project Data", "The subject line of the email send by the 'Send Email' Action. The {0} will be replaced by the name of the project, as in 'Greek WeSay Project Data'"), projectInfo.Name); string body = StringCatalog.Get("The latest WeSay project data is attached."); //I tried hard to get this to run in a thread so it wouldn't block wesay, //but when called in a thread we always just get the generic '2' back. // EmailMessage emailWorker = // new EmailMessage( // subject, // body, // msg); ///emailWorker.SendMail(); /// msg.SendMailPopup(subject, body); }