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


C# SendEmailRequest.WithReplyToAddresses方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: SendEmail

    public string SendEmail(Hashtable State, string from, string to, string cc, string bcc, string subject, string body, string attach_path, bool isBodyHtml)
    {
        string AWSAccessKey = ConfigurationManager.AppSettings["AWSAccessKey"];
        string AWSSecretKey = ConfigurationManager.AppSettings["AWSSecretKey"];

        AmazonSimpleEmailService ses = AWSClientFactory.CreateAmazonSimpleEmailServiceClient(AWSAccessKey, AWSSecretKey);

        SendEmailRequest request = new SendEmailRequest();
        Destination destination = new Destination();

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

        if (cc != null && cc.Length > 0)
        {
            List<String> CC = new List<String>(cc.Replace(", ", ",").Split(','));
            destination.WithCcAddresses(CC);
        }

        if (bcc != null && bcc.Length > 0)
        {
            List<String> BCC = new List<String>(bcc.Replace(", ", ",").Split(','));
            destination.WithBccAddresses(BCC);
        }

        request.WithDestination(destination);

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

        Body SESbody = new Body();
        if (isBodyHtml)
        {
            Content SEShtml = new Content();
            SEShtml.WithCharset("UTF-8");
            SEShtml.WithData(body);
            SESbody.WithHtml(SEShtml);
        }
        else
        {
            Content text = new Content();
            text.WithCharset("UTF-8");
            text.WithData(body);
            SESbody.WithText(text);
        }

        Message message = new Message();
        message.WithBody(SESbody);
        message.WithSubject(SESsubject);

        request.WithMessage(message);
        request.WithSource(from);

        List<String> replyto = new List<String>(from.Replace(", ", ",").Split(','));
        request.WithReplyToAddresses(replyto);

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

        try
        {
            SendEmailResponse response = ses.SendEmail(request);
            SendEmailResult result = response.SendEmailResult;
            return "OK";
        }
        catch (Exception ex)
        {
            Util util = new Util();
            util.LogError(State, ex);
            return ex.Message;
        }
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:75,代码来源:AmazonSES.cs

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