/// <summary> /// Send SimpleMAPI email /// </summary> public void SendMapi(string exceptionReport, IntPtr windowHandle) { var mapi = new Mapi(); mapi.Logon(windowHandle); mapi.Reset(); var emailAddress = string.IsNullOrEmpty(_reportInfo.EmailReportAddress) ? _reportInfo.ContactEmail : _reportInfo.EmailReportAddress; mapi.AddRecipient(emailAddress, null, false); AttachMapiScreenshotIfRequired(mapi); mapi.Send(EmailSubject, exceptionReport, true); mapi.Logoff(); }
// public void Send_textWithCC(string to,string subject,string textMail,string textCCMailAddress ) // { // // } public void Send_text(string to,string subject,string textMail ) { try { ma1= new Mapi(); ma1.AddRecip(to, null, false ); /* if( textCC.Text != null ) { if( textCC.Text.Length > 0 ) ma.AddRecip( textCC.Text, null, true ); } */ //lblStatus.Text="Current Status : Sending Message"; if( ! ma1.Send( subject, textMail ) ) MessageBox.Show( this, "MAPISendMail failed! " + ma1.Error(), "Send Mail", MessageBoxButtons.OK, MessageBoxIcon.Warning ); ma1.Reset(); //this.Close(); } catch(Exception exp) { MessageBox.Show(exp.Message.ToString()); } }