public Guid SendMapiSubmitSystemProbe(string senderEmailAddress, string recipientEmailAddress, out string internetMessageId) { SendMapiMailDefinition mapiMailDefinition = this.MonitoringFactory.MakeSendMapiMailDefinition(senderEmailAddress, recipientEmailAddress); internetMessageId = null; string entryId; Guid mbxGuid; this.MapiMessageSubmitter.SendMapiMessage(mapiMailDefinition, out entryId, out internetMessageId, out mbxGuid); return(MapiSubmitSystemProbeHandler.ComputeSystemProbeId(entryId, mbxGuid)); }
public virtual SendMapiMailDefinition MakeSendMapiMailDefinition(string senderEmailAddress, string recipientEmailAddress) { if (string.IsNullOrEmpty(senderEmailAddress)) { throw new ArgumentNullException("senderEmailAddress"); } if (string.IsNullOrEmpty(recipientEmailAddress)) { recipientEmailAddress = senderEmailAddress; } return(SendMapiMailDefinition.CreateInstance(this.Subject, "This is a Mapi System Probe message that's Submitted to Store so that Mailbox transport Submission service can process it", "IPM.Note.MapiSubmitSystemProbe", true, true, senderEmailAddress, recipientEmailAddress)); }
public static SendMapiMailDefinition CreateInstance(string subject, string body, string messageClass, bool doNotDeliver, bool deleteAfterSubmit, string senderEmail, string recipientEmail) { return(SendMapiMailDefinition.CreateInstance(subject, body, messageClass, doNotDeliver, false, deleteAfterSubmit, senderEmail, Guid.Empty, Guid.Empty, recipientEmail, false)); }
private void SendMapiMessageHelper(bool setLamNotificationId, string lamNotificationId, SendMapiMailDefinition mapiMailDefinition, bool returnOutParameters, out string entryId, out string internetMessageId, out Guid senderMbxGuid) { entryId = string.Empty; internetMessageId = string.Empty; senderMbxGuid = Guid.Empty; ExchangePrincipal mailboxOwner; if (mapiMailDefinition.SenderMbxGuid != Guid.Empty) { mailboxOwner = ExchangePrincipal.FromMailboxData(mapiMailDefinition.SenderMbxGuid, mapiMailDefinition.SenderMdbGuid, new List <CultureInfo>(0)); } else { string domainPartOfEmailAddress = MapiMessageSubmitter.GetDomainPartOfEmailAddress(mapiMailDefinition.SenderEmailAddress); mailboxOwner = ExchangePrincipal.FromProxyAddress(ADSessionSettings.RootOrgOrSingleTenantFromAcceptedDomainAutoDetect(domainPartOfEmailAddress), mapiMailDefinition.SenderEmailAddress); } using (MailboxSession mailboxSession = MailboxSession.OpenAsTransport(mailboxOwner, "Client=Monitoring;Action=MapiSubmitLAMProbe")) { using (MessageItem messageItem = MessageItem.Create(mailboxSession, mailboxSession.GetDefaultFolderId(DefaultFolderType.Outbox))) { messageItem.ClassName = mapiMailDefinition.MessageClass; if (setLamNotificationId) { messageItem[MessageItemSchema.MapiSubmitLamNotificationId] = lamNotificationId; messageItem[MessageItemSchema.XLAMNotificationId] = lamNotificationId; } messageItem[MessageItemSchema.DoNotDeliver] = (mapiMailDefinition.DoNotDeliver ? "Supress" : "Deliver"); if (mapiMailDefinition.DropMessageInHub) { messageItem[MessageItemSchema.DropMessageInHub] = "FrontEnd-CAT-250"; messageItem[MessageItemSchema.SystemProbeDrop] = "OnEndOfHeaders"; } messageItem.Subject = mapiMailDefinition.MessageSubject; BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextPlain); using (TextWriter textWriter = messageItem.Body.OpenTextWriter(configuration)) { textWriter.Write(mapiMailDefinition.MessageBody); } messageItem.Recipients.Add(new Participant(mapiMailDefinition.RecipientEmailAddress, mapiMailDefinition.RecipientEmailAddress, "SMTP"), RecipientItemType.To); if (mapiMailDefinition.DeleteAfterSubmit) { messageItem.SendWithoutSavingMessage(); } else { messageItem.Send(); } if (returnOutParameters) { senderMbxGuid = mailboxSession.MailboxGuid; messageItem.Load(new PropertyDefinition[] { StoreObjectSchema.EntryId, ItemSchema.InternetMessageId }); object obj = messageItem.TryGetProperty(StoreObjectSchema.EntryId); byte[] entryId2 = (byte[])obj; entryId = MapiMessageSubmitter.EntryIdString(entryId2); object obj2 = messageItem.TryGetProperty(ItemSchema.InternetMessageId); internetMessageId = obj2.ToString(); } } } }
public void SendMapiMessage(SendMapiMailDefinition mapiMailDefinition, out string entryId, out string internetMessageId, out Guid senderMbxGuid) { this.SendMapiMessageHelper(false, null, mapiMailDefinition, true, out entryId, out internetMessageId, out senderMbxGuid); }
public void SendMapiMessage(string lamNotificationId, SendMapiMailDefinition mapiMailDefinition, out string entryId, out string internetMessageId, out Guid senderMbxGuid) { this.SendMapiMessageHelper(true, lamNotificationId, mapiMailDefinition, true, out entryId, out internetMessageId, out senderMbxGuid); }