public static SentEmailResponse Create(LogEntry logEntry, EmailPreviewResponse preview, bool matchedReceiversToTest)
        {
            string[] logEntryTo = ArrayUtility.GetArrayFromCommaSeparatedString(logEntry.To);

            return(new SentEmailResponse()
            {
                Id = logEntry.Id.ToString(),
                EmailServiceId = logEntry.EmailServiceId,

                Subject = preview.Subject,

                MatchedReceiversToTest = matchedReceiversToTest,
                NumberOfReceivers = logEntryTo.Length,

                ContentType = preview.ContentType,
                Message = preview.Preview
            });
        }
Esempio n. 2
0
        private bool TestReceiversMatch(string[] receiversToTestArray, LogEntry logEntry)
        {
            string[] logEntryTo = ArrayUtility.GetArrayFromCommaSeparatedString(logEntry.To);
            bool     isSameSize = logEntryTo.Length == receiversToTestArray.Length;

            if (!isSameSize)
            {
                return(false);
            }

            foreach (string receiver in receiversToTestArray)
            {
                string hashedReceiver       = HashUtility.GetStringHash(receiver);
                bool   isReceiverInLogEntry = logEntryTo.Contains(hashedReceiver);

                if (!isReceiverInLogEntry)
                {
                    return(false);
                }
            }

            return(true);
        }