Esempio n. 1
0
 public bool UnpackSendFile()
 {
     try
     {
         if (string.IsNullOrWhiteSpace(unpackFile.RtfText)) throw new Exception("Нет текста");
         string fileName = Path.GetTempPath() + Guid.NewGuid() + ".rtf";
         using (StreamWriter writer = File.CreateText(fileName))
             writer.Write(unpackFile.RtfText);
         var mapi = new Mapi();
         mapi.AddAttachment(fileName);
         mapi.SendMailPopup("", "");
         File.Delete(fileName);
         return true;
     }
     catch (Exception exception)
     {
         XtraMessageBox.Show(exception.Message);
     }
     return false;
 }
Esempio n. 2
0
 public bool PackSendImage()
 {
     try
     {
         if (_outputBitmap == null) throw new Exception("Нет изображения");
         string fileName = Path.GetTempPath() + Guid.NewGuid() + ".bmp";
         _outputBitmap.Save(fileName);
         var mapi = new Mapi();
         mapi.AddAttachment(fileName);
         mapi.SendMailPopup("", "");
         File.Delete(fileName);
         return true;
     }
     catch (Exception exception)
     {
         XtraMessageBox.Show(exception.Message);
     }
     return false;
 }