当前位置: 首页>>代码示例>>C#>>正文


C# SendEmailRequest.WithReturnPath方法代码示例

本文整理汇总了C#中Amazon.SimpleEmail.Model.SendEmailRequest.WithReturnPath方法的典型用法代码示例。如果您正苦于以下问题:C# SendEmailRequest.WithReturnPath方法的具体用法?C# SendEmailRequest.WithReturnPath怎么用?C# SendEmailRequest.WithReturnPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Amazon.SimpleEmail.Model.SendEmailRequest的用法示例。


在下文中一共展示了SendEmailRequest.WithReturnPath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            AmazonSimpleEmailServiceConfig amConfig = new AmazonSimpleEmailServiceConfig();
            amConfig.UseSecureStringForAwsSecretKey = false;
            AmazonSimpleEmailServiceClient amzClient = new AmazonSimpleEmailServiceClient(ConfigurationManager.AppSettings["AWSAccessKey"].ToString(), ConfigurationManager.AppSettings["AWSSecretKey"].ToString(),amConfig);
            ArrayList to = new ArrayList();
            //ADD AS TO 50 emails per one sending method//////////////////////
            //to.Add("[email protected]");
            //to.Add("[email protected]");
            to.Add("[email protected]");
            to.Add("[email protected]");
            to.Add("[email protected]");
            to.Add("[email protected]");
            to.Add("[email protected]");
            to.Add("[email protected]");

            Destination dest = new Destination();
            dest.WithToAddresses((string[])to.ToArray(typeof(string)));

            //dest.WithToAddresses((string[])to.ToArray(typeof(string)));
            string body = "INSERT HTML BODY HERE";
            string subject = "INSERT EMAIL SUBJECT HERE";
            Body bdy = new Body();
            bdy.Html = new Amazon.SimpleEmail.Model.Content(body);
            Amazon.SimpleEmail.Model.Content title = new Amazon.SimpleEmail.Model.Content(subject);
            Message message = new Message(title, bdy);

               //VerifyEmailAddressRequest veaRequest = new VerifyEmailAddressRequest();
               // veaRequest.EmailAddress = "[email protected]";
               // VerifyEmailAddressResponse veaResponse = amzClient.VerifyEmailAddress(veaRequest);

            SendEmailRequest ser = new SendEmailRequest("[email protected]", dest, message);

            ser.WithReturnPath("[email protected]");
            SendEmailResponse seResponse = amzClient.SendEmail(ser);
            SendEmailResult seResult = seResponse.SendEmailResult;

            //GetSendStatisticsRequest request=new GetSendStatisticsRequest();

            //GetSendStatisticsResponse obj = amzClient.GetSendStatistics(request);

            //List<SendDataPoint> sdata = new List<SendDataPoint>();
            //sdata=obj.GetSendStatisticsResult.SendDataPoints;

            //Int64 sentCount = 0,BounceCount=0,DeleveryAttempts=0;

            //for (int i = 0; i < sdata.Count; i++)
            //{
            //    BounceCount = BounceCount +sdata[i].Bounces;
            //    DeleveryAttempts = DeleveryAttempts + sdata[i].DeliveryAttempts;
            //}
            //sentCount = DeleveryAttempts - BounceCount;
        }
开发者ID:shekar348,项目名称:1PointOne,代码行数:53,代码来源:AWS2.aspx.cs

示例2: SendMail

 /// <summary>
 /// The send mail.
 /// </summary>
 /// <param name="from">
 /// The from.
 /// </param>
 /// <param name="to">
 /// The to.
 /// </param>
 /// <param name="subject">
 /// The subject.
 /// </param>
 /// <param name="body">
 /// The body.
 /// </param>
 public void SendMail(string @from, string to, string subject, string body)
 {
     using (var client = Amazon.AWSClientFactory.CreateAmazonSimpleEmailServiceClient(this.credentials))
     {
         var request = new SendEmailRequest();
         var destination = new Destination(to.Split(';', ',').ToList());
         request.WithDestination(destination);
         request.WithSource(@from);
         var message = new Message();
         message.WithSubject(new Content(subject));
         var html = new Body { Html = new Content(body) };
         message.WithBody(html);
         request.WithMessage(message);
         request.WithReturnPath("[email protected]");
         client.SendEmail(request);
     }
 }
开发者ID:Naviam,项目名称:Shop-Any-Ware,代码行数:32,代码来源:AmazonSimpleEmailService.cs

示例3: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            AmazonSimpleEmailServiceConfig amConfig = new AmazonSimpleEmailServiceConfig();
            amConfig.UseSecureStringForAwsSecretKey = false;
            AmazonSimpleEmailServiceClient amzClient = new AmazonSimpleEmailServiceClient(ConfigurationManager.AppSettings["AWSAccessKey"].ToString(), ConfigurationManager.AppSettings["AWSSecretKey"].ToString(), amConfig);
            ArrayList to = new ArrayList();
            to.Add("[email protected]");
            //to.Add("[email protected]");
            for (int i = 0; i < to.Count; i++)
            {
                Destination dest = new Destination();
                dest.WithToAddresses(to[i].ToString());
                string body = "Hello this is testing AWS";
                string subject = "Test AWS";
                Body bdy = new Body();
                bdy.Html = new Amazon.SimpleEmail.Model.Content(body);
                Amazon.SimpleEmail.Model.Content title = new Amazon.SimpleEmail.Model.Content(subject);
                Message message = new Message(title, bdy);
                SendEmailRequest ser = new SendEmailRequest("[email protected]", dest, message);
                ser.WithReturnPath("[email protected]");
                SendEmailResponse seResponse = amzClient.SendEmail(ser);
                SendEmailResult seResult = seResponse.SendEmailResult;

            }

            //GetSendStatisticsRequest request = new GetSendStatisticsRequest();
            //GetSendStatisticsResponse obj = amzClient.GetSendStatistics(request);
            //List<SendDataPoint> sdata = new List<SendDataPoint>();
            //sdata = obj.GetSendStatisticsResult.SendDataPoints;
            //Int64 sentCount = 0, BounceCount = 0, DeleveryAttempts = 0;
            //for (int i = 0; i < sdata.Count; i++)
            //{
            //    BounceCount = BounceCount + sdata[i].Bounces;
            //    DeleveryAttempts = DeleveryAttempts + sdata[i].DeliveryAttempts;
            //}
            //sentCount = DeleveryAttempts - BounceCount;
        }
开发者ID:shekar348,项目名称:1PointOne,代码行数:37,代码来源:AWS3.aspx.cs

示例4: SendEmail

        public bool SendEmail(String From, String To, String Subject, String Text, String HTML, String emailReplyTo, String returnPath)
        {
            if (Text != null && HTML != null)

             {
             String from = From;

             List<String> to = To.Replace(", ", ",").Split(',').ToList();

            Destination destination = new Destination();

             destination.WithToAddresses(to);

             //destination.WithCcAddresses(cc);

             //destination.WithBccAddresses(bcc);

             Amazon.SimpleEmail.Model.Content subject = new Amazon.SimpleEmail.Model.Content();

             subject.WithCharset("UTF-8");

             subject.WithData(Subject);

             Amazon.SimpleEmail.Model.Content html = new Amazon.SimpleEmail.Model.Content();

             html.WithCharset("UTF-8");

             html.WithData(HTML);

             Amazon.SimpleEmail.Model.Content text = new Amazon.SimpleEmail.Model.Content();

             text.WithCharset("UTF-8");

             text.WithData(Text);

             Body body = new Body();

             body.WithHtml(html);

             body.WithText(text);

             Message message = new Message();

             message.WithBody(body);

             message.WithSubject(subject);
             //AmazonSimpleEmailServiceConfig config = new AmazonSimpleEmailServiceConfig();
             //config.ServiceURL = "http://aws.amazon.com/articles/3051?_encoding=UTF8&jiveRedirect=1";
             //config.ProxyPort = 465;

            // AmazonSimpleEmailService ses = new AmazonSimpleEmailServiceClient(awsAccessKeyId, awsSecretAccessKey);

             AmazonSimpleEmailService ses = AWSClientFactory.CreateAmazonSimpleEmailServiceClient(AppConfig["AWSAccessKey"], AppConfig["AWSSecretKey"]);

             SendEmailRequest request = new SendEmailRequest();

             request.WithDestination(destination);

             request.WithMessage(message);

             request.WithSource(from);

             if (emailReplyTo != null)
             {

             List<String> replyto  = emailReplyTo.Replace(", ", ",").Split(',').ToList();

             request.WithReplyToAddresses(replyto);

             }

             if (returnPath != null)
             {
             request.WithReturnPath(returnPath);
              }

             try

             {

             SendEmailResponse response = ses.SendEmail(request);

             SendEmailResult result = response.SendEmailResult;

             Console.WriteLine("Email sent.");

             Console.WriteLine(String.Format("Message ID: {0}",result.MessageId));

             return true;

             }

             catch (Exception ex)
            {

             Console.WriteLine(ex.Message);

             return false;

             }
//.........这里部分代码省略.........
开发者ID:shekar348,项目名称:1PointOne,代码行数:101,代码来源:AWS.aspx.cs

示例5: SendEmail

        public static Boolean SendEmail(String From, String To, String Subject, String Text = null, String HTML = null, String emailReplyTo = null, String returnPath = null)
        {
            if (Text != null || HTML != null)
            {
                try
                {

                    String from = From;

                    List<String> to
                        = To
                            .Replace(", ", ",")
                            .Split(',')
                            .ToList();

                    Destination destination = new Destination();
                    destination.WithToAddresses(to);
                    //destination.WithCcAddresses(cc);
                    //destination.WithBccAddresses(bcc);

                    Content subject = new Content();
                    subject.WithCharset("UTF-8");
                    subject.WithData(Subject);

                    Body body = new Body();

                    if (HTML != null)
                    {
                        Content html = new Content();
                        html.WithCharset("UTF-8");
                        html.WithData(HTML);
                        body.WithHtml(html);
                    }

                    if (Text != null)
                    {
                        Content text = new Content();
                        text.WithCharset("UTF-8");
                        text.WithData(Text);
                        body.WithText(text);
                    }

                    Message message = new Message();
                    message.WithBody(body);
                    message.WithSubject(subject);

                    string awsAccessKey = AWSAccessKey;
                    string awsSecretKey = AWSSecretKey;
                    //AmazonSimpleEmailService ses = AWSClientFactory.CreateAmazonSimpleEmailServiceClient(AppConfig["AWSAccessKey"], AppConfig["AWSSecretKey"]);
                    AmazonSimpleEmailService ses = AWSClientFactory.CreateAmazonSimpleEmailServiceClient(awsAccessKey,
                                                                                                         awsSecretKey);

                    SendEmailRequest request = new SendEmailRequest();
                    request.WithDestination(destination);
                    request.WithMessage(message);
                    request.WithSource(from);

                    if (emailReplyTo != null)
                    {
                        List<String> replyto
                            = emailReplyTo
                                .Replace(", ", ",")
                                .Split(',')
                                .ToList();

                        request.WithReplyToAddresses(replyto);
                    }

                    if (returnPath != null)
                    {
                        request.WithReturnPath(returnPath);
                    }

                    SendEmailResponse response = ses.SendEmail(request);

                    SendEmailResult result = response.SendEmailResult;

                    Console.WriteLine("Email sent.");
                    Console.WriteLine(String.Format("Message ID: {0}",
                                                    result.MessageId));

                    return true;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    //throw;
                    return false;
                }
                finally
                {
                    String queueMessage = String.Format("From: {1}{0}To: {2}{0}Subject: {3}{0}Message:{0}{4}",
                                                        Environment.NewLine, From, To, Subject, Text ?? HTML);
                    QueueSupport.CurrStatisticsQueue.AddMessage(new CloudQueueMessage(queueMessage));
                }
            }

            Console.WriteLine("Specify Text and/or HTML for the email body!");

            return false;
//.........这里部分代码省略.........
开发者ID:kallex,项目名称:Caloom,代码行数:101,代码来源:EmailSupport.cs

示例6: SendEmail

        ///<Summary>
        /// Gets the answer
        ///</Summary>
        public static Boolean SendEmail(String From, String To, String Subject, String Text = null, String HTML = null, String emailReplyTo = null, String returnPath = null)
        {
            if (Text != null && HTML != null)
            {
                String from = From;

                List<String> to
                    = To
                    .Replace(", ", ",")
                    .Split(',')
                    .ToList();

                Destination destination = new Destination();
                destination.WithToAddresses(to);
                //destination.WithCcAddresses(cc);
                //destination.WithBccAddresses(bcc);

                Amazon.SimpleEmail.Model.Content subject = new Amazon.SimpleEmail.Model.Content();
                subject.WithCharset("UTF-8");
                subject.WithData(Subject);

                Amazon.SimpleEmail.Model.Content html = new Amazon.SimpleEmail.Model.Content();
                html.WithCharset("UTF-8");
                html.WithData(HTML);

                Amazon.SimpleEmail.Model.Content text = new Amazon.SimpleEmail.Model.Content();
                text.WithCharset("UTF-8");
                text.WithData(Text);

                Body body = new Body();
                body.WithHtml(html);
                body.WithText(text);

                Amazon.SimpleEmail.Model.Message message = new Amazon.SimpleEmail.Model.Message();
                message.WithBody(body);
                message.WithSubject(subject);

                AmazonSimpleEmailService ses = AWSClientFactory.CreateAmazonSimpleEmailServiceClient(AppConfig["AWSAccessKey"], AppConfig["AWSSecretKey"]);

                SendEmailRequest request = new SendEmailRequest();
                request.WithDestination(destination);
                request.WithMessage(message);
                request.WithSource(from);

                if (emailReplyTo != null)
                {
                    List<String> replyto
                        = emailReplyTo
                        .Replace(", ", ",")
                        .Split(',')
                        .ToList();

                    request.WithReplyToAddresses(replyto);
                }

                if (returnPath != null)
                {
                    request.WithReturnPath(returnPath);
                }

                try
                {
                    SendEmailResponse response = ses.SendEmail(request);

                    SendEmailResult result = response.SendEmailResult;

                    return true;
                }
                catch
                {
                    return false;
                }
            }

            return false;
        }
开发者ID:RomaKiev1,项目名称:AdSaverJobs,代码行数:79,代码来源:SendEmailJob.cs

示例7: SendEmail

        public static Boolean SendEmail(String From, Recipient recipient, String Subject, String Text = null, 
            String HTML = null, String emailReplyTo = null, String returnPath = null)
        {
            if (Text != null && HTML != null)
            {
                String from = From;
                List<String> to = recipient.Email
                    .Replace(", ", ",")
                    .Split(',')
                    .ToList();

                Destination destination = new Destination();
                destination.WithToAddresses(recipient.Email);
                //destination.WithCcAddresses(cc);
                //destination.WithBccAddresses(bcc);

                Content subject = new Content();
                subject.WithCharset("UTF-8");
                subject.WithData(Subject);

                Content html = new Content();
                html.WithCharset("UTF-8");
                html.WithData(HTML);

                Content text = new Content();
                text.WithCharset("UTF-8");
                text.WithData(Text);

                Body body = new Body();
                body.WithHtml(html);
                body.WithText(text);

                Message message = new Message();
                message.WithBody(body);
                message.WithSubject(subject);

                string accessKey = ConfigurationManager.AppSettings["AWSAccessKey"];
                string secretKey = ConfigurationManager.AppSettings["AWSSecretKey"];

                AmazonSimpleEmailService ses = AWSClientFactory.CreateAmazonSimpleEmailServiceClient(accessKey, secretKey);
                SendEmailRequest request = new SendEmailRequest();
                request.WithDestination(destination);
                request.WithMessage(message);
                request.WithSource(from);

                if (emailReplyTo != null)
                {
                    List<String> replyto
                        = emailReplyTo
                        .Replace(", ", ",")
                        .Split(',')
                        .ToList();

                    request.WithReplyToAddresses(replyto);
                }

                if (returnPath != null)
                {
                    request.WithReturnPath(returnPath);
                }

                try
                {
                    SendEmailResponse response = ses.SendEmail(request);
                    SendEmailResult result = response.SendEmailResult;
                    return true;
                }
                catch (Exception ex)
                {
                    recipient.ErrorMessage = ex.Message;
                    return false;
                }
            }

            throw new Exception("Specify Text and/or HTML for the email body!");
        }
开发者ID:beaujackson,项目名称:AESMailer,代码行数:76,代码来源:Mailer.cs


注:本文中的Amazon.SimpleEmail.Model.SendEmailRequest.WithReturnPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。