public void SimpleEmailServiceCreateReceiptRule()
        {
            #region createreceiptrule-1469122946515

            var response = client.CreateReceiptRule(new CreateReceiptRuleRequest
            {
                After = "",
                Rule  = new ReceiptRule {
                    Actions = new List <ReceiptAction> {
                        new ReceiptAction {
                            S3Action = new S3Action {
                                BucketName      = "MyBucket",
                                ObjectKeyPrefix = "email"
                            }
                        }
                    },
                    Enabled     = true,
                    Name        = "MyRule",
                    ScanEnabled = true,
                    TlsPolicy   = "Optional"
                },
                RuleSetName = "MyRuleSet"
            });


            #endregion
        }
예제 #2
0
        public void CreateReceiptRule(IAmazonSimpleEmailService client, string email)
        {
            try
            {
                var objCreateReceiptRuleRequest = new CreateReceiptRuleRequest
                {
                    RuleSetName = email.Replace("@", "-")
                };

                var lstReceiptAction = new List <ReceiptAction>();
                var objReceiptAction = new ReceiptAction();
                var objS3Action      = new S3Action
                {
                    BucketName      = email.ToLower().Replace("@", "-").Replace(".", "-"),
                    ObjectKeyPrefix = string.Empty,
                    TopicArn        = "arn:aws:sns:us-west-2:803078631911:test-email",
                    KmsKeyArn       = string.Empty,
                };
                objReceiptAction.S3Action = objS3Action;

                lstReceiptAction.Add(objReceiptAction);

                var objReceiptRule = new ReceiptRule
                {
                    Name        = email.Substring(0, 3),
                    ScanEnabled = true,
                    Enabled     = true,
                    Actions     = lstReceiptAction,
                    TlsPolicy   = TlsPolicy.Optional,
                    Recipients  = new List <string> {
                        email
                    }
                };
                objCreateReceiptRuleRequest.Rule = objReceiptRule;
                client.CreateReceiptRule(objCreateReceiptRuleRequest);
            }
            catch
            {
                // ignored
            }
        }
예제 #3
0
 private Amazon.SimpleEmail.Model.CreateReceiptRuleResponse CallAWSServiceOperation(IAmazonSimpleEmailService client, Amazon.SimpleEmail.Model.CreateReceiptRuleRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Email Service (SES)", "CreateReceiptRule");
     try
     {
         #if DESKTOP
         return(client.CreateReceiptRule(request));
         #elif CORECLR
         return(client.CreateReceiptRuleAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }