/// <summary>
        /// Send a meeting response email
        /// </summary>
        /// <param name="calendar">The meeting calendar</param>
        protected void SendMeetingResponse(Calendar calendar)
        {
            // Create reply mail to organizer
            string emailBody = Common.GenerateResourceName(Site, "content");
            string icalendarResponseContent = TestSuiteHelper.CreateMeetingResponseiCalendarFormatContent(
                (DateTime)calendar.DtStamp,
                (DateTime)calendar.EndTime,
                calendar.UID,
                calendar.Subject,
                calendar.Location,
                calendar.OrganizerEmail,
                calendar.Attendees.Attendee[0].Email);

            // Create reply mail mime content
            string meetingResponseEmailMime = TestSuiteHelper.CreateMeetingRequestMime(
                calendar.Attendees.Attendee[0].Email,
                calendar.OrganizerEmail,
                calendar.Subject,
                emailBody,
                icalendarResponseContent);

            string          clientId        = TestSuiteHelper.GetClientId();
            SendMailRequest sendMailRequest = TestSuiteHelper.CreateSendMailRequest(clientId, false, meetingResponseEmailMime);

            this.SwitchUser(this.User2Information, true);
            SendMailResponse response = this.EMAILAdapter.SendMail(sendMailRequest);

            Site.Assert.AreEqual <string>(
                string.Empty,
                response.ResponseDataXML,
                "The server should return an empty xml response data to indicate SendMail command success.");
        }
        /// <summary>
        /// Send a plain text email.
        /// </summary>
        /// <param name="subject">The subject of email</param>
        /// <param name="cc">The cc address of the mail</param>
        /// <param name="bcc">The bcc address of the mail</param>
        /// <param name="to">The to address of the mail</param>
        /// <param name="sender">The sender address of the mail</param>
        /// <param name="replyTo">The replyTo address of the mail</param>
        /// <param name="from">The from address of the mail</param>
        protected void SendPlaintextEmail(
            string subject,
            string cc,
            string bcc,
            string to,
            string sender,
            string replyTo,
            string from)
        {
            string emailBody = Common.GenerateResourceName(Site, "content");

            string emailMime = TestSuiteHelper.CreatePlainTextMime(
                string.IsNullOrEmpty(from) ? Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain) : from,
                string.IsNullOrEmpty(to) ? Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain) : to,
                cc,
                bcc,
                subject,
                emailBody,
                sender,
                replyTo);
            string clientId = TestSuiteHelper.GetClientId();

            SendMailRequest sendMailRequest = TestSuiteHelper.CreateSendMailRequest(clientId, false, emailMime);

            this.SwitchUser(this.User1Information, false);
            SendMailResponse response = this.EMAILAdapter.SendMail(sendMailRequest);

            Site.Assert.AreEqual <string>(
                string.Empty,
                response.ResponseDataXML,
                "The server should return an empty xml response data to indicate SendMail command was executed successfully.");
        }
        /// <summary>
        /// Send a plain text email.
        /// </summary>
        /// <param name="subject">The subject of email</param>
        /// <param name="cc">The cc address of the mail</param>
        /// <param name="bcc">The bcc address of the mail</param>
        protected void SendPlaintextEmail(string subject, string cc, string bcc)
        {
            string emailBody = Common.GenerateResourceName(Site, "content");
            string emailMime = TestSuiteHelper.CreatePlainTextMime(
                Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain),
                Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain),
                cc,
                bcc,
                subject,
                emailBody);
            string clientId = TestSuiteHelper.GetClientId();

            SendMailRequest sendMailRequest = TestSuiteHelper.CreateSendMailRequest(clientId, false, emailMime);

            this.SwitchUser(this.User1Information, false);
            SendMailResponse response = this.EMAILAdapter.SendMail(sendMailRequest);

            Site.Assert.AreEqual <string>(
                string.Empty,
                response.ResponseDataXML,
                "The server should return an empty xml response data to indicate SendMail command executes successfully.");

            this.SwitchUser(this.User2Information, true);
            this.RecordCaseRelativeItems(this.User2Information.UserName, this.User2Information.InboxCollectionId, subject);
        }
Exemple #4
0
        /// <summary>
        /// Call SendMail command to send one voice email
        /// </summary>
        /// <param name="emailSubject">Email subject</param>
        /// <param name="firstVoiceFilePath">First voice attachment file name</param>
        /// <param name="secondVoiceFilePath">Second voice attachment file name</param>
        /// <returns>Email item</returns>
        private Sync SendVoiceMail(string emailSubject, string firstVoiceFilePath, string secondVoiceFilePath)
        {
            // Create mail content
            string senderEmail   = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain);
            string receiverEmail = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain);
            string emailBody     = Common.GenerateResourceName(Site, "content");
            string callNumber    = "7125550123";

            // Create voice mail content mime
            string voiceMailMime = TestSuiteHelper.CreateVoiceAttachmentMime(
                senderEmail,
                receiverEmail,
                emailSubject,
                emailBody,
                callNumber,
                firstVoiceFilePath,
                secondVoiceFilePath);

            string           clientId        = TestSuiteHelper.GetClientId();
            SendMailRequest  sendMailRequest = TestSuiteHelper.CreateSendMailRequest(clientId, false, voiceMailMime);
            SendMailResponse response        = this.EMAILAdapter.SendMail(sendMailRequest);

            // Verify send voice mail success
            Site.Assert.AreEqual <string>(
                string.Empty,
                response.ResponseDataXML,
                "The server should return an empty xml response data to indicate SendMail command executes successfully.",
                response.ResponseDataXML);

            #region Record user name, folder collectionId and item subject that are used in this case.
            this.SwitchUser(this.User2Information, true);
            this.RecordCaseRelativeItems(this.User2Information.UserName, this.User2Information.InboxCollectionId, emailSubject);
            #endregion

            #region Sync changes in user2 mailbox .
            // Sync changes
            SyncStore result    = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);
            Sync      emailItem = TestSuiteHelper.GetSyncAddItem(result, emailSubject);
            #endregion

            return(emailItem);
        }
        /// <summary>
        /// Send a meeting request email.
        /// </summary>
        /// <param name="subject">The subject of email</param>
        /// <param name="calendar">The meeting calendar</param>
        protected void SendMeetingRequest(string subject, Calendar calendar)
        {
            string emailBody = Common.GenerateResourceName(Site, "content");
            string icalendarFormatContent = TestSuiteHelper.CreateiCalendarFormatContent(calendar);

            string meetingEmailMime = TestSuiteHelper.CreateMeetingRequestMime(
                calendar.OrganizerEmail,
                calendar.Attendees.Attendee[0].Email,
                subject,
                emailBody,
                icalendarFormatContent);
            string clientId = TestSuiteHelper.GetClientId();

            SendMailRequest sendMailRequest = TestSuiteHelper.CreateSendMailRequest(clientId, false, meetingEmailMime);

            this.SwitchUser(this.User1Information, false);
            SendMailResponse response = this.EMAILAdapter.SendMail(sendMailRequest);

            Site.Assert.AreEqual <string>(
                string.Empty,
                response.ResponseDataXML,
                "The server should return an empty xml response data to indicate SendMail command success.");
        }