Пример #1
0
        private void AddMapiAttachments(Mapi mapi)
        {
            if (_reportInfo.ScreenshotAvailable)
            {
                mapi.Attach(ScreenshotTaker.GetImageAsFile(_reportInfo.ScreenshotImage));
            }

            foreach (string file in _reportInfo.FilesToAttach)
            {
                mapi.Attach(file);
            }
        }
Пример #2
0
 private void AttachMapiScreenshotIfRequired(Mapi mapi)
 {
     if (_reportInfo.ScreenshotAvailable)
     {
         mapi.Attach(ScreenshotTaker.GetImageAsFile(_reportInfo.ScreenshotImage));
     }
 }
Пример #3
0
        private void buttonSend_Click(object sender, System.EventArgs e)
        {
            ma.Attach(this.filename);
            lblStatus.Text = "Current Status :  Adding Recipients";
            ma.AddRecip(textTO.Text, null, false);
            if (textCC.Text != null)
            {
                if (textCC.Text.Length > 0)
                {
                    ma.AddRecip(textCC.Text, null, true);
                }
            }
            lblStatus.Text = "Current Status :  Sending Message";
            if (!ma.Send(textSubject.Text, textMail.Text))
            {
                MessageBox.Show(this, "MAPISendMail failed! " + ma.Error(), "Send Mail", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            ma.Reset();
            this.Close();
        }
Пример #4
0
        /// <summary>
        /// Send a message using mapi dll built into windows
        /// </summary>
        /// <returns></returns>
        private bool SendMapiMessage()
        {
            try
            {
                string subject = "Error in " + myErrorInformation.ProgramName;

                myErrorInformation.Steps = txtSteps.Text;

                Mapi myMapi = new Mapi();
                myMapi.AddRecip("", myErrorInformation.SupportEmail, false);
                myMapi.Attach(myErrorInformation.ScreenShot);
                myMapi.Attach(myErrorInformation.EventLogText);
                myMapi.Send(subject, myErrorInformation.GetXMLMessage());

                return(true);
            }
            catch (Exception ex)
            {
                //Smtp server send failed, send with a mailto link
                GuiException.HandleException(ex);
                return(false);
            }
        }
Пример #5
0
        static void Main(string[] args)
        {
            // Mapi-Instanz erzeugen
            Mapi mapi = new Mapi();

            // Logon in MAPI. Sie können den aktuellen
            // Benutzer einloggen, indem Sie IntPtr.Zero übergeben.
            // Wollen Sie einen spezifischen Benutzer einloggen,
            // können Sie ein Token über die API-Funktion LogonUser
            // erzeugen und dessen Handle übergeben.
            if (mapi.Logon(IntPtr.Zero) == false)
            {
                Console.WriteLine("Der Login in MAPI ist fehlgeschlagen: " + mapi.Error());
                return;
            }

            // Empfänger hinzufügen
            string mailAddress = "*****@*****.**";

            mapi.AddRecip(mailAddress, null, false);

            // Datei anfügen
            string fileName = Path.Combine(Application.StartupPath, "dontpanic.gif");

            mapi.Attach(fileName);

            // Mail senden
            string subject = "Party";
            string message = "Hallo Zaphod, hast du Lust auf eine Party im Restaurant " +
                             "am Ende der Galaxis?";

            if (mapi.Send(subject, message))
            {
                Console.WriteLine("E-Mail erfolgreich versendet");
            }
            else
            {
                Console.WriteLine("Das Senden ist fehlgeschlagen: {0}", mapi.Error());
            }

            // Aus MAPI ausloggen
            mapi.Logoff();

            Console.WriteLine("Beenden mit Return");
            Console.ReadLine();
        }