コード例 #1
0
 /// <summary>
 /// Sends MIME-formatted e-mail messages to the server.
 /// </summary>
 /// <param name="sendMailRequest">The request for SendMail operation.</param>
 /// <returns>The SendMail response which is returned from the server.</returns>
 public SendMailResponse SendMail(SendMailRequest sendMailRequest)
 {
     SendMailResponse response = this.activeSyncClient.SendMail(sendMailRequest);
     Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null.");
     this.VerifyTransport();
     return response;
 }
コード例 #2
0
        public ActionResult Index(SendMailRequest request) {
            if (!ModelState.IsValid)
                return View();

            try {
                mailSender.Send(
                    new MailAddress(request.From),
                    new MailAddress(request.To),
                    request.Subject,
                    request.Body);
            }
            catch (Exception ex) {
                ModelState.AddModelError(string.Empty, ex.Message);
                return View();
            }

            return RedirectToRoute("Default");
        }
コード例 #3
0
        /// <summary>
        /// The method is used to send a mail
        /// </summary>
        /// <param name="emailType">The type of the email.</param>
        /// <param name="subject">The subject of the mail.</param>
        /// <param name="body">The body of the item.</param>
        protected void SendEmail(EmailType emailType, string subject, string body)
        {
            SendMailRequest request = new SendMailRequest
            {
                RequestData =
                {
                    ClientId = Guid.NewGuid().ToString("N"),
                    Mime = TestSuiteHelper.CreateMIME(
                        emailType,
                        Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain),
                        Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain),
                        subject,
                        body)
                }
            };

            SendMailResponse sendMailResponse = this.ASAIRSAdapter.SendMail(request);
            this.Site.Assert.AreEqual<string>(
                 string.Empty,
                 sendMailResponse.ResponseDataXML,
                 "The server should return an empty XML body to indicate SendMail command is executed successfully.");

            this.SwitchUser(this.User2Information, true);
            this.RecordCaseRelativeItems(this.User2Information.UserName, this.User2Information.InboxCollectionId, subject);
        }
コード例 #4
0
 /// <summary>
 /// Create a SendMailRequest instance using specified information
 /// </summary>
 /// <param name="accountId">Specified the account Id</param>
 /// <param name="clientId">Specified the client Id</param>
 /// <param name="mime">Specified the mime</param>
 /// <returns>A SendMailRequest instance</returns>
 public static SendMailRequest CreateSendMailRequest(string accountId, string clientId, string mime)
 {
     SendMailRequest request = new SendMailRequest();
     Request.SendMail requestData = new Request.SendMail
     {
         AccountId = accountId,
         ClientId = clientId,
         Mime = mime
     };
     request.RequestData = requestData;
     return request;
 }
コード例 #5
0
 /// <summary>
 /// Create an empty SendMailRequest instance
 /// </summary>
 /// <returns>An empty SendMailRequest instance</returns>
 public static SendMailRequest CreateSendMailRequest()
 {
     SendMailRequest request = new SendMailRequest();
     Request.SendMail requestData = new Request.SendMail();
     request.RequestData = requestData;
     return request;
 }
コード例 #6
0
 /// <summary>
 /// Sends MIME-formatted e-mail messages to the server.
 /// </summary>
 /// <param name="request">A SendMailRequest object that contains the request information.</param>
 /// <returns>A SendMailResponse object.</returns>
 public SendMailResponse SendMail(SendMailRequest request)
 {
     SendMailResponse response = this.activeSyncClient.SendMail(request);
     Site.Assert.IsNotNull(response, "If the SendMail command executes successfully, the response from server should not be null.");
     return response;
 }
コード例 #7
0
        /// <summary>
        /// The method is used to send a mail
        /// </summary>
        /// <param name="subject">The subject of the mail.</param>
        /// <param name="body">The body of the item.</param>
        protected void SendEmail(string subject, string body)
        {
            SendMailRequest request = new SendMailRequest
            {
                RequestData =
                {
                    ClientId = Guid.NewGuid().ToString("N"),
                    Mime = TestSuiteHelper.CreateMIME(
                           Common.GetMailAddress(Common.GetConfigurationPropertyValue("User1Name", this.Site), Common.GetConfigurationPropertyValue("Domain", this.Site)),
                           Common.GetMailAddress(Common.GetConfigurationPropertyValue("User2Name", this.Site), Common.GetConfigurationPropertyValue("Domain", this.Site)),
                           subject,
                           body)
                }
            };

            SendMailResponse sendMailResponse = this.ASCNTCAdapter.SendMail(request);
            this.Site.Assert.AreEqual<string>(
                 string.Empty,
                 sendMailResponse.ResponseDataXML,
                 "The server should return an empty XML body to indicate SendMail command executes successfully.");
        }
コード例 #8
0
        /// <summary>
        /// Send an email with a normal attachment
        /// </summary>
        /// <param name="subject">The subject of the mail.</param>
        /// <param name="body">The body of the item.</param>
        protected void SendEmailWithAttachment(string subject, string body)
        {
            string from = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain);
            string to = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain);
            string mime = TestSuiteBase.CreateMIME(from, to, subject, body);

            SendMailRequest request = new SendMailRequest
            {
                RequestData = { ClientId = TestSuiteBase.ClientId, Mime = mime }
            };

            SendMailResponse sendMailResponse = this.CMDAdapter.SendMail(request);
            Site.Assert.AreEqual<string>(
                 string.Empty,
                 sendMailResponse.ResponseDataXML,
                 "The server should return an empty XML body to indicate SendMail command is executed successfully.");
        }
コード例 #9
0
        /// <summary>
        /// Sends MIME-formatted e-mail messages to the server.
        /// </summary>
        /// <param name="sendMailRequest">A SendMailRequest object that contains the request information.</param>
        /// <returns>SendMail command response.</returns>
        public SendMailResponse SendMail(SendMailRequest sendMailRequest)
        {
            SendMailResponse sendMailResponse = this.activeSyncClient.SendMail(sendMailRequest);
            Site.Assert.IsNotNull(sendMailResponse, "The SendMail response returned from server should not be null.");

            return sendMailResponse;
        }