2017-05-11 16:39:54 +02:00
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package ses_test
import (
"fmt"
2017-07-23 09:51:42 +02:00
"strings"
2017-05-11 16:39:54 +02:00
"time"
"github.com/aws/aws-sdk-go/aws"
2017-07-23 09:51:42 +02:00
"github.com/aws/aws-sdk-go/aws/awserr"
2017-05-11 16:39:54 +02:00
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ses"
)
var _ time . Duration
2017-07-23 09:51:42 +02:00
var _ strings . Reader
var _ aws . Config
2017-05-11 16:39:54 +02:00
2017-07-23 09:51:42 +02:00
func parseTime ( layout , value string ) * time . Time {
t , err := time . Parse ( layout , value )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
panic ( err )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
return & t
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// CloneReceiptRuleSet
//
// The following example creates a receipt rule set by cloning an existing one:
func ExampleSES_CloneReceiptRuleSet_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . CloneReceiptRuleSetInput {
OriginalRuleSetName : aws . String ( "RuleSetToClone" ) ,
RuleSetName : aws . String ( "RuleSetToCreate" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . CloneReceiptRuleSet ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeRuleSetDoesNotExistException :
fmt . Println ( ses . ErrCodeRuleSetDoesNotExistException , aerr . Error ( ) )
case ses . ErrCodeAlreadyExistsException :
fmt . Println ( ses . ErrCodeAlreadyExistsException , aerr . Error ( ) )
case ses . ErrCodeLimitExceededException :
fmt . Println ( ses . ErrCodeLimitExceededException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// CreateReceiptFilter
//
// The following example creates a new IP address filter:
func ExampleSES_CreateReceiptFilter_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . CreateReceiptFilterInput {
Filter : & ses . ReceiptFilter {
IpFilter : & ses . ReceiptIpFilter {
Cidr : aws . String ( "1.2.3.4/24" ) ,
Policy : aws . String ( "Allow" ) ,
2017-05-11 16:39:54 +02:00
} ,
2017-07-23 09:51:42 +02:00
Name : aws . String ( "MyFilter" ) ,
2017-05-11 16:39:54 +02:00
} ,
}
2017-07-23 09:51:42 +02:00
result , err := svc . CreateReceiptFilter ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeLimitExceededException :
fmt . Println ( ses . ErrCodeLimitExceededException , aerr . Error ( ) )
case ses . ErrCodeAlreadyExistsException :
fmt . Println ( ses . ErrCodeAlreadyExistsException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// CreateReceiptRule
//
// The following example creates a new receipt rule:
func ExampleSES_CreateReceiptRule_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . CreateReceiptRuleInput {
After : aws . String ( "" ) ,
Rule : & ses . ReceiptRule {
2017-05-11 16:39:54 +02:00
Actions : [ ] * ses . ReceiptAction {
2018-03-19 16:51:38 +01:00
{
S3Action : & ses . S3Action {
BucketName : aws . String ( "MyBucket" ) ,
ObjectKeyPrefix : aws . String ( "email" ) ,
} ,
} ,
2017-05-11 16:39:54 +02:00
} ,
2017-07-23 09:51:42 +02:00
Enabled : aws . Bool ( true ) ,
Name : aws . String ( "MyRule" ) ,
2017-05-11 16:39:54 +02:00
ScanEnabled : aws . Bool ( true ) ,
2017-07-23 09:51:42 +02:00
TlsPolicy : aws . String ( "Optional" ) ,
2017-05-11 16:39:54 +02:00
} ,
2017-07-23 09:51:42 +02:00
RuleSetName : aws . String ( "MyRuleSet" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . CreateReceiptRule ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeInvalidSnsTopicException :
fmt . Println ( ses . ErrCodeInvalidSnsTopicException , aerr . Error ( ) )
case ses . ErrCodeInvalidS3ConfigurationException :
fmt . Println ( ses . ErrCodeInvalidS3ConfigurationException , aerr . Error ( ) )
case ses . ErrCodeInvalidLambdaFunctionException :
fmt . Println ( ses . ErrCodeInvalidLambdaFunctionException , aerr . Error ( ) )
case ses . ErrCodeAlreadyExistsException :
fmt . Println ( ses . ErrCodeAlreadyExistsException , aerr . Error ( ) )
case ses . ErrCodeRuleDoesNotExistException :
fmt . Println ( ses . ErrCodeRuleDoesNotExistException , aerr . Error ( ) )
case ses . ErrCodeRuleSetDoesNotExistException :
fmt . Println ( ses . ErrCodeRuleSetDoesNotExistException , aerr . Error ( ) )
case ses . ErrCodeLimitExceededException :
fmt . Println ( ses . ErrCodeLimitExceededException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// CreateReceiptRuleSet
//
// The following example creates an empty receipt rule set:
func ExampleSES_CreateReceiptRuleSet_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . CreateReceiptRuleSetInput {
RuleSetName : aws . String ( "MyRuleSet" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . CreateReceiptRuleSet ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeAlreadyExistsException :
fmt . Println ( ses . ErrCodeAlreadyExistsException , aerr . Error ( ) )
case ses . ErrCodeLimitExceededException :
fmt . Println ( ses . ErrCodeLimitExceededException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// DeleteIdentity
//
// The following example deletes an identity from the list of identities that have been
// submitted for verification with Amazon SES:
func ExampleSES_DeleteIdentity_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . DeleteIdentityInput {
Identity : aws . String ( "user@example.com" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . DeleteIdentity ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// DeleteIdentityPolicy
//
// The following example deletes a sending authorization policy for an identity:
func ExampleSES_DeleteIdentityPolicy_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . DeleteIdentityPolicyInput {
Identity : aws . String ( "user@example.com" ) ,
PolicyName : aws . String ( "MyPolicy" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . DeleteIdentityPolicy ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// DeleteReceiptFilter
//
// The following example deletes an IP address filter:
func ExampleSES_DeleteReceiptFilter_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . DeleteReceiptFilterInput {
FilterName : aws . String ( "MyFilter" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . DeleteReceiptFilter ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// DeleteReceiptRule
//
// The following example deletes a receipt rule:
func ExampleSES_DeleteReceiptRule_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . DeleteReceiptRuleInput {
RuleName : aws . String ( "MyRule" ) ,
RuleSetName : aws . String ( "MyRuleSet" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . DeleteReceiptRule ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeRuleSetDoesNotExistException :
fmt . Println ( ses . ErrCodeRuleSetDoesNotExistException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// DeleteReceiptRuleSet
//
// The following example deletes a receipt rule set:
func ExampleSES_DeleteReceiptRuleSet_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . DeleteReceiptRuleSetInput {
RuleSetName : aws . String ( "MyRuleSet" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . DeleteReceiptRuleSet ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeCannotDeleteException :
fmt . Println ( ses . ErrCodeCannotDeleteException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// DeleteVerifiedEmailAddress
//
// The following example deletes an email address from the list of identities that have
// been submitted for verification with Amazon SES:
func ExampleSES_DeleteVerifiedEmailAddress_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . DeleteVerifiedEmailAddressInput {
EmailAddress : aws . String ( "user@example.com" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . DeleteVerifiedEmailAddress ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// DescribeActiveReceiptRuleSet
//
// The following example returns the metadata and receipt rules for the receipt rule
// set that is currently active:
func ExampleSES_DescribeActiveReceiptRuleSet_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . DescribeActiveReceiptRuleSetInput { }
2017-05-11 16:39:54 +02:00
2017-07-23 09:51:42 +02:00
result , err := svc . DescribeActiveReceiptRuleSet ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// DescribeReceiptRule
//
// The following example returns the details of a receipt rule:
func ExampleSES_DescribeReceiptRule_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . DescribeReceiptRuleInput {
RuleName : aws . String ( "MyRule" ) ,
RuleSetName : aws . String ( "MyRuleSet" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . DescribeReceiptRule ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeRuleDoesNotExistException :
fmt . Println ( ses . ErrCodeRuleDoesNotExistException , aerr . Error ( ) )
case ses . ErrCodeRuleSetDoesNotExistException :
fmt . Println ( ses . ErrCodeRuleSetDoesNotExistException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// DescribeReceiptRuleSet
//
// The following example returns the metadata and receipt rules of a receipt rule set:
func ExampleSES_DescribeReceiptRuleSet_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . DescribeReceiptRuleSetInput {
RuleSetName : aws . String ( "MyRuleSet" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . DescribeReceiptRuleSet ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeRuleSetDoesNotExistException :
fmt . Println ( ses . ErrCodeRuleSetDoesNotExistException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2018-01-16 14:20:59 +01:00
// GetAccountSendingEnabled
//
// The following example returns if sending status for an account is enabled. (true
// / false):
func ExampleSES_GetAccountSendingEnabled_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . GetAccountSendingEnabledInput { }
result , err := svc . GetAccountSendingEnabled ( input )
if err != nil {
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
return
}
fmt . Println ( result )
}
2017-07-23 09:51:42 +02:00
// GetIdentityDkimAttributes
//
// The following example retrieves the Amazon SES Easy DKIM attributes for a list of
// identities:
func ExampleSES_GetIdentityDkimAttributes_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . GetIdentityDkimAttributesInput {
Identities : [ ] * string {
aws . String ( "example.com" ) ,
aws . String ( "user@example.com" ) ,
2017-05-11 16:39:54 +02:00
} ,
}
2017-07-23 09:51:42 +02:00
result , err := svc . GetIdentityDkimAttributes ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// GetIdentityMailFromDomainAttributes
//
// The following example returns the custom MAIL FROM attributes for an identity:
func ExampleSES_GetIdentityMailFromDomainAttributes_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . GetIdentityMailFromDomainAttributesInput {
Identities : [ ] * string {
aws . String ( "example.com" ) ,
2017-05-11 16:39:54 +02:00
} ,
}
2017-07-23 09:51:42 +02:00
result , err := svc . GetIdentityMailFromDomainAttributes ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// GetIdentityNotificationAttributes
//
// The following example returns the notification attributes for an identity:
func ExampleSES_GetIdentityNotificationAttributes_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . GetIdentityNotificationAttributesInput {
Identities : [ ] * string {
aws . String ( "example.com" ) ,
2017-05-11 16:39:54 +02:00
} ,
}
2017-07-23 09:51:42 +02:00
result , err := svc . GetIdentityNotificationAttributes ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// GetIdentityPolicies
//
// The following example returns a sending authorization policy for an identity:
func ExampleSES_GetIdentityPolicies_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . GetIdentityPoliciesInput {
Identity : aws . String ( "example.com" ) ,
PolicyNames : [ ] * string {
aws . String ( "MyPolicy" ) ,
2017-05-11 16:39:54 +02:00
} ,
}
2017-07-23 09:51:42 +02:00
result , err := svc . GetIdentityPolicies ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// GetIdentityVerificationAttributes
//
// The following example returns the verification status and the verification token
// for a domain identity:
func ExampleSES_GetIdentityVerificationAttributes_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . GetIdentityVerificationAttributesInput {
Identities : [ ] * string {
aws . String ( "example.com" ) ,
2017-05-11 16:39:54 +02:00
} ,
}
2017-07-23 09:51:42 +02:00
result , err := svc . GetIdentityVerificationAttributes ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// GetSendQuota
//
// The following example returns the Amazon SES sending limits for an AWS account:
func ExampleSES_GetSendQuota_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . GetSendQuotaInput { }
2017-05-11 16:39:54 +02:00
2017-07-23 09:51:42 +02:00
result , err := svc . GetSendQuota ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// GetSendStatistics
//
// The following example returns Amazon SES sending statistics:
func ExampleSES_GetSendStatistics_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . GetSendStatisticsInput { }
2017-05-11 16:39:54 +02:00
2017-07-23 09:51:42 +02:00
result , err := svc . GetSendStatistics ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// ListIdentities
//
// The following example lists the email address identities that have been submitted
// for verification with Amazon SES:
func ExampleSES_ListIdentities_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . ListIdentitiesInput {
IdentityType : aws . String ( "EmailAddress" ) ,
MaxItems : aws . Int64 ( 123 ) ,
NextToken : aws . String ( "" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . ListIdentities ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// ListIdentityPolicies
//
// The following example returns a list of sending authorization policies that are attached
// to an identity:
func ExampleSES_ListIdentityPolicies_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . ListIdentityPoliciesInput {
Identity : aws . String ( "example.com" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . ListIdentityPolicies ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// ListReceiptFilters
//
// The following example lists the IP address filters that are associated with an AWS
// account:
func ExampleSES_ListReceiptFilters_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . ListReceiptFiltersInput { }
2017-05-11 16:39:54 +02:00
2017-07-23 09:51:42 +02:00
result , err := svc . ListReceiptFilters ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// ListReceiptRuleSets
//
// The following example lists the receipt rule sets that exist under an AWS account:
func ExampleSES_ListReceiptRuleSets_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . ListReceiptRuleSetsInput {
NextToken : aws . String ( "" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . ListReceiptRuleSets ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// ListVerifiedEmailAddresses
//
// The following example lists all email addresses that have been submitted for verification
// with Amazon SES:
func ExampleSES_ListVerifiedEmailAddresses_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . ListVerifiedEmailAddressesInput { }
2017-05-11 16:39:54 +02:00
2017-07-23 09:51:42 +02:00
result , err := svc . ListVerifiedEmailAddresses ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// PutIdentityPolicy
//
// The following example adds a sending authorization policy to an identity:
func ExampleSES_PutIdentityPolicy_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . PutIdentityPolicyInput {
Identity : aws . String ( "example.com" ) ,
Policy : aws . String ( "{\"Version\":\"2008-10-17\",\"Statement\":[{\"Sid\":\"stmt1469123904194\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::123456789012:root\"},\"Action\":[\"ses:SendEmail\",\"ses:SendRawEmail\"],\"Resource\":\"arn:aws:ses:us-east-1:EXAMPLE65304:identity/example.com\"}]}" ) ,
PolicyName : aws . String ( "MyPolicy" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . PutIdentityPolicy ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeInvalidPolicyException :
fmt . Println ( ses . ErrCodeInvalidPolicyException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// ReorderReceiptRuleSet
//
// The following example reorders the receipt rules within a receipt rule set:
func ExampleSES_ReorderReceiptRuleSet_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . ReorderReceiptRuleSetInput {
RuleNames : [ ] * string {
aws . String ( "MyRule" ) ,
aws . String ( "MyOtherRule" ) ,
2017-05-11 16:39:54 +02:00
} ,
2017-07-23 09:51:42 +02:00
RuleSetName : aws . String ( "MyRuleSet" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . ReorderReceiptRuleSet ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeRuleSetDoesNotExistException :
fmt . Println ( ses . ErrCodeRuleSetDoesNotExistException , aerr . Error ( ) )
case ses . ErrCodeRuleDoesNotExistException :
fmt . Println ( ses . ErrCodeRuleDoesNotExistException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// SendEmail
//
// The following example sends a formatted email:
func ExampleSES_SendEmail_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . SendEmailInput {
Destination : & ses . Destination {
2017-05-11 16:39:54 +02:00
CcAddresses : [ ] * string {
2017-07-23 09:51:42 +02:00
aws . String ( "recipient3@example.com" ) ,
2017-05-11 16:39:54 +02:00
} ,
ToAddresses : [ ] * string {
2017-07-23 09:51:42 +02:00
aws . String ( "recipient1@example.com" ) ,
aws . String ( "recipient2@example.com" ) ,
2017-05-11 16:39:54 +02:00
} ,
} ,
2017-07-23 09:51:42 +02:00
Message : & ses . Message {
Body : & ses . Body {
2017-05-11 16:39:54 +02:00
Html : & ses . Content {
2017-07-23 09:51:42 +02:00
Charset : aws . String ( "UTF-8" ) ,
Data : aws . String ( "This message body contains HTML formatting. It can, for example, contain links like this one: <a class=\"ulink\" href=\"http://docs.aws.amazon.com/ses/latest/DeveloperGuide\" target=\"_blank\">Amazon SES Developer Guide</a>." ) ,
2017-05-11 16:39:54 +02:00
} ,
Text : & ses . Content {
2017-07-23 09:51:42 +02:00
Charset : aws . String ( "UTF-8" ) ,
Data : aws . String ( "This is the message body in text format." ) ,
2017-05-11 16:39:54 +02:00
} ,
} ,
2017-07-23 09:51:42 +02:00
Subject : & ses . Content {
Charset : aws . String ( "UTF-8" ) ,
Data : aws . String ( "Test email" ) ,
2017-05-11 16:39:54 +02:00
} ,
} ,
2017-07-23 09:51:42 +02:00
ReturnPath : aws . String ( "" ) ,
ReturnPathArn : aws . String ( "" ) ,
Source : aws . String ( "sender@example.com" ) ,
SourceArn : aws . String ( "" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . SendEmail ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeMessageRejected :
fmt . Println ( ses . ErrCodeMessageRejected , aerr . Error ( ) )
case ses . ErrCodeMailFromDomainNotVerifiedException :
fmt . Println ( ses . ErrCodeMailFromDomainNotVerifiedException , aerr . Error ( ) )
case ses . ErrCodeConfigurationSetDoesNotExistException :
fmt . Println ( ses . ErrCodeConfigurationSetDoesNotExistException , aerr . Error ( ) )
2018-01-16 14:20:59 +01:00
case ses . ErrCodeConfigurationSetSendingPausedException :
fmt . Println ( ses . ErrCodeConfigurationSetSendingPausedException , aerr . Error ( ) )
case ses . ErrCodeAccountSendingPausedException :
fmt . Println ( ses . ErrCodeAccountSendingPausedException , aerr . Error ( ) )
2017-07-23 09:51:42 +02:00
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// SendRawEmail
//
// The following example sends an email with an attachment:
func ExampleSES_SendRawEmail_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . SendRawEmailInput {
FromArn : aws . String ( "" ) ,
RawMessage : & ses . RawMessage {
Data : [ ] byte ( "From: sender@example.com\\nTo: recipient@example.com\\nSubject: Test email (contains an attachment)\\nMIME-Version: 1.0\\nContent-type: Multipart/Mixed; boundary=\"NextPart\"\\n\\n--NextPart\\nContent-Type: text/plain\\n\\nThis is the message body.\\n\\n--NextPart\\nContent-Type: text/plain;\\nContent-Disposition: attachment; filename=\"attachment.txt\"\\n\\nThis is the text in the attachment.\\n\\n--NextPart--" ) ,
2017-05-11 16:39:54 +02:00
} ,
2017-07-23 09:51:42 +02:00
ReturnPathArn : aws . String ( "" ) ,
Source : aws . String ( "" ) ,
SourceArn : aws . String ( "" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . SendRawEmail ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeMessageRejected :
fmt . Println ( ses . ErrCodeMessageRejected , aerr . Error ( ) )
case ses . ErrCodeMailFromDomainNotVerifiedException :
fmt . Println ( ses . ErrCodeMailFromDomainNotVerifiedException , aerr . Error ( ) )
case ses . ErrCodeConfigurationSetDoesNotExistException :
fmt . Println ( ses . ErrCodeConfigurationSetDoesNotExistException , aerr . Error ( ) )
2018-01-16 14:20:59 +01:00
case ses . ErrCodeConfigurationSetSendingPausedException :
fmt . Println ( ses . ErrCodeConfigurationSetSendingPausedException , aerr . Error ( ) )
case ses . ErrCodeAccountSendingPausedException :
fmt . Println ( ses . ErrCodeAccountSendingPausedException , aerr . Error ( ) )
2017-07-23 09:51:42 +02:00
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// SetActiveReceiptRuleSet
//
// The following example sets the active receipt rule set:
func ExampleSES_SetActiveReceiptRuleSet_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . SetActiveReceiptRuleSetInput {
RuleSetName : aws . String ( "RuleSetToActivate" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . SetActiveReceiptRuleSet ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeRuleSetDoesNotExistException :
fmt . Println ( ses . ErrCodeRuleSetDoesNotExistException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// SetIdentityDkimEnabled
//
// The following example configures Amazon SES to Easy DKIM-sign the email sent from
// an identity:
func ExampleSES_SetIdentityDkimEnabled_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . SetIdentityDkimEnabledInput {
DkimEnabled : aws . Bool ( true ) ,
Identity : aws . String ( "user@example.com" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . SetIdentityDkimEnabled ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// SetIdentityFeedbackForwardingEnabled
//
// The following example configures Amazon SES to forward an identity's bounces and
// complaints via email:
func ExampleSES_SetIdentityFeedbackForwardingEnabled_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . SetIdentityFeedbackForwardingEnabledInput {
ForwardingEnabled : aws . Bool ( true ) ,
Identity : aws . String ( "user@example.com" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . SetIdentityFeedbackForwardingEnabled ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// SetIdentityHeadersInNotificationsEnabled
//
// The following example configures Amazon SES to include the original email headers
// in the Amazon SNS bounce notifications for an identity:
func ExampleSES_SetIdentityHeadersInNotificationsEnabled_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . SetIdentityHeadersInNotificationsEnabledInput {
Enabled : aws . Bool ( true ) ,
Identity : aws . String ( "user@example.com" ) ,
NotificationType : aws . String ( "Bounce" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . SetIdentityHeadersInNotificationsEnabled ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// SetIdentityMailFromDomain
//
// The following example configures Amazon SES to use a custom MAIL FROM domain for
// an identity:
func ExampleSES_SetIdentityMailFromDomain_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . SetIdentityMailFromDomainInput {
BehaviorOnMXFailure : aws . String ( "UseDefaultValue" ) ,
Identity : aws . String ( "user@example.com" ) ,
MailFromDomain : aws . String ( "bounces.example.com" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . SetIdentityMailFromDomain ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// SetIdentityNotificationTopic
//
// The following example sets the Amazon SNS topic to which Amazon SES will publish
// bounce, complaint, and/or delivery notifications for emails sent with the specified
// identity as the Source:
func ExampleSES_SetIdentityNotificationTopic_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . SetIdentityNotificationTopicInput {
Identity : aws . String ( "user@example.com" ) ,
NotificationType : aws . String ( "Bounce" ) ,
SnsTopic : aws . String ( "arn:aws:sns:us-west-2:111122223333:MyTopic" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . SetIdentityNotificationTopic ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// SetReceiptRulePosition
//
// The following example sets the position of a receipt rule in a receipt rule set:
func ExampleSES_SetReceiptRulePosition_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . SetReceiptRulePositionInput {
After : aws . String ( "PutRuleAfterThisRule" ) ,
RuleName : aws . String ( "RuleToReposition" ) ,
RuleSetName : aws . String ( "MyRuleSet" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . SetReceiptRulePosition ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeRuleSetDoesNotExistException :
fmt . Println ( ses . ErrCodeRuleSetDoesNotExistException , aerr . Error ( ) )
case ses . ErrCodeRuleDoesNotExistException :
fmt . Println ( ses . ErrCodeRuleDoesNotExistException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2018-01-16 14:20:59 +01:00
fmt . Println ( result )
}
// UpdateAccountSendingEnabled
//
// The following example updated the sending status for this account.
func ExampleSES_UpdateAccountSendingEnabled_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . UpdateAccountSendingEnabledInput {
Enabled : aws . Bool ( true ) ,
}
result , err := svc . UpdateAccountSendingEnabled ( input )
if err != nil {
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
return
}
fmt . Println ( result )
}
// UpdateConfigurationSetReputationMetricsEnabled
//
// Set the reputationMetricsEnabled flag for a specific configuration set.
func ExampleSES_UpdateConfigurationSetReputationMetricsEnabled_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . UpdateConfigurationSetReputationMetricsEnabledInput {
ConfigurationSetName : aws . String ( "foo" ) ,
Enabled : aws . Bool ( true ) ,
}
result , err := svc . UpdateConfigurationSetReputationMetricsEnabled ( input )
if err != nil {
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeConfigurationSetDoesNotExistException :
fmt . Println ( ses . ErrCodeConfigurationSetDoesNotExistException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
return
}
fmt . Println ( result )
}
// UpdateConfigurationSetReputationMetricsEnabled
//
// Set the sending enabled flag for a specific configuration set.
func ExampleSES_UpdateConfigurationSetSendingEnabled_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . UpdateConfigurationSetSendingEnabledInput {
ConfigurationSetName : aws . String ( "foo" ) ,
Enabled : aws . Bool ( true ) ,
}
result , err := svc . UpdateConfigurationSetSendingEnabled ( input )
if err != nil {
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeConfigurationSetDoesNotExistException :
fmt . Println ( ses . ErrCodeConfigurationSetDoesNotExistException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// UpdateReceiptRule
//
// The following example updates a receipt rule to use an Amazon S3 action:
func ExampleSES_UpdateReceiptRule_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . UpdateReceiptRuleInput {
Rule : & ses . ReceiptRule {
2017-05-11 16:39:54 +02:00
Actions : [ ] * ses . ReceiptAction {
2018-03-19 16:51:38 +01:00
{
S3Action : & ses . S3Action {
BucketName : aws . String ( "MyBucket" ) ,
ObjectKeyPrefix : aws . String ( "email" ) ,
} ,
} ,
2017-05-11 16:39:54 +02:00
} ,
2017-07-23 09:51:42 +02:00
Enabled : aws . Bool ( true ) ,
Name : aws . String ( "MyRule" ) ,
2017-05-11 16:39:54 +02:00
ScanEnabled : aws . Bool ( true ) ,
2017-07-23 09:51:42 +02:00
TlsPolicy : aws . String ( "Optional" ) ,
2017-05-11 16:39:54 +02:00
} ,
2017-07-23 09:51:42 +02:00
RuleSetName : aws . String ( "MyRuleSet" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . UpdateReceiptRule ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
case ses . ErrCodeInvalidSnsTopicException :
fmt . Println ( ses . ErrCodeInvalidSnsTopicException , aerr . Error ( ) )
case ses . ErrCodeInvalidS3ConfigurationException :
fmt . Println ( ses . ErrCodeInvalidS3ConfigurationException , aerr . Error ( ) )
case ses . ErrCodeInvalidLambdaFunctionException :
fmt . Println ( ses . ErrCodeInvalidLambdaFunctionException , aerr . Error ( ) )
case ses . ErrCodeRuleSetDoesNotExistException :
fmt . Println ( ses . ErrCodeRuleSetDoesNotExistException , aerr . Error ( ) )
case ses . ErrCodeRuleDoesNotExistException :
fmt . Println ( ses . ErrCodeRuleDoesNotExistException , aerr . Error ( ) )
case ses . ErrCodeLimitExceededException :
fmt . Println ( ses . ErrCodeLimitExceededException , aerr . Error ( ) )
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// VerifyDomainDkim
//
// The following example generates DKIM tokens for a domain that has been verified with
// Amazon SES:
func ExampleSES_VerifyDomainDkim_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . VerifyDomainDkimInput {
Domain : aws . String ( "example.com" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . VerifyDomainDkim ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// VerifyDomainIdentity
//
// The following example starts the domain verification process with Amazon SES:
func ExampleSES_VerifyDomainIdentity_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . VerifyDomainIdentityInput {
Domain : aws . String ( "example.com" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . VerifyDomainIdentity ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// VerifyEmailAddress
//
// The following example starts the email address verification process with Amazon SES:
func ExampleSES_VerifyEmailAddress_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . VerifyEmailAddressInput {
EmailAddress : aws . String ( "user@example.com" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . VerifyEmailAddress ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
// VerifyEmailIdentity
//
// The following example starts the email address verification process with Amazon SES:
func ExampleSES_VerifyEmailIdentity_shared00 ( ) {
svc := ses . New ( session . New ( ) )
input := & ses . VerifyEmailIdentityInput {
EmailAddress : aws . String ( "user@example.com" ) ,
2017-05-11 16:39:54 +02:00
}
2017-07-23 09:51:42 +02:00
result , err := svc . VerifyEmailIdentity ( input )
2017-05-11 16:39:54 +02:00
if err != nil {
2017-07-23 09:51:42 +02:00
if aerr , ok := err . ( awserr . Error ) ; ok {
switch aerr . Code ( ) {
default :
fmt . Println ( aerr . Error ( ) )
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt . Println ( err . Error ( ) )
}
2017-05-11 16:39:54 +02:00
return
}
2017-07-23 09:51:42 +02:00
fmt . Println ( result )
2017-05-11 16:39:54 +02:00
}