

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# Amazon SES API 및 AWS SDK for PHP 버전 3을 사용하여 발신자 권한 부여
<a name="ses-sender-policy"></a>

다른 AWS 계정, AWS Identity and Access Management 사용자 또는 AWS 서비스가 사용자를 대신해 Amazon Simple Email Service (Amazon SES)를 통해 이메일을 전송할 수 있도록 하려면 전송 권한 부여 정책을 만듭니다. 이는 소유한 보안 인증에 연결하는 JSON 문서입니다.

이 정책은 누가 어떤 조건으로 해당 보안 인증을 사용하여 전송할 수 있는지 명시적으로 나열합니다. 사용자와 사용자가 정책에서 명시적으로 권한을 부여한 개체 이외의 모든 발신자는 이메일을 전송할 수 없습니다. 보안 인증은 연결된 정책이 없을 수도, 하나 또는 여러 개일 수도 있습니다. 또한 다중 정책의 효과를 구현하기 위해 복수의 문을 포함한 단일 정책을 생성할 수도 있습니다.

자세한 내용은 [Amazon SES에서 전송 권한 부여 사용](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html)을 참조하세요.

다음 예제에서는 다음과 같은 작업을 하는 방법을 보여줍니다.
+ [PutIdentityPolicy](https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-email-2010-12-01.html#createidentitypolicy)를 사용하여 권한 있는 발신자 만들기
+ [GetIdentityPolicies](https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-email-2010-12-01.html#getidentitypolicies)를 사용하여 권한 있는 발신자에 대한 정책 검색
+ [ListIdentityPolicies](https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-email-2010-12-01.html#listidentitypolicies)를 사용하여 권한 있는 발신자 나열
+ [DeleteIdentityPolicy](https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-email-2010-12-01.html#deleteidentitypolicy)를 사용하여 권한 있는 발신자의 권한 취소

AWS SDK for PHP에 대한 모든 예제 코드는 [GitHub](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/php/example_code)에서 사용할 수 있습니다.

## 보안 인증 정보
<a name="examplecredentials"></a>

예제 코드를 실행하기 전에 [AWS SDK for PHP 버전 3을 AWS 사용하여 로 인증](credentials.md)에 설명된 대로 AWS 보안 인증을 구성합니다. 그 다음 [AWS SDK for PHP 버전 3 설치](getting-started_installation.md)에 설명된 대로 AWS SDK for PHP를 가져옵니다.

Amazon SES 사용에 대한 자세한 내용은 [Amazon SES 개발자 안내서](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/)를 참조하세요.

## 권한 있는 발신자 만들기
<a name="create-an-authorized-sender"></a>

다른 AWS 계정 계정에 사용자를 대신해 이메일을 전송할 수 있는 권한을 부여하려면 보안 인증 정책을 사용하거나 확인된 이메일 주소 또는 도메인에서 이메일을 전송하도록 권한 부여를 추가하거나 업데이트합니다. 보안 인증 정책을 만들려면 [PutIdentityPolicy](https://docs.aws.amazon.com/ses/latest/APIReference/API_PutIdentityPolicy.html) 작업을 사용합니다.

 **가져옵니다**.

```
require 'vendor/autoload.php';

use Aws\Exception\AwsException;
use Aws\Ses\SesClient;
```

 **샘플 코드** 

```
$SesClient = new SesClient([
    'profile' => 'default',
    'version' => '2010-12-01',
    'region' => 'us-east-1'
]);

$identity = "arn:aws:ses:us-east-1:123456789012:identity/example.com";
$other_aws_account = "0123456789";
$policy = <<<EOT
{
  "Id":"ExampleAuthorizationPolicy",
  "Version":"2012-10-17",		 	 	 
  "Statement":[
    {
      "Sid":"AuthorizeAccount",
      "Effect":"Allow",
      "Resource":"$identity",
      "Principal":{
        "AWS":[ "$other_aws_account" ]
      },
      "Action":[
        "SES:SendEmail",
        "SES:SendRawEmail"
      ]
    }
  ]
}
EOT;
$name = "policyName";

try {
    $result = $SesClient->putIdentityPolicy([
        'Identity' => $identity,
        'Policy' => $policy,
        'PolicyName' => $name,
    ]);
    var_dump($result);
} catch (AwsException $e) {
    // output error message if fails
    echo $e->getMessage();
    echo "\n";
}
```

## 권한 있는 발신자에 대한 정책 검색
<a name="retrieve-polices-for-an-authorized-sender"></a>

특정 이메일 보안 인증 또는 도메인 보안 인증과 연결된 전송 권한 부여 정책을 반환합니다. 지정된 이메일 주소 또는 도메인에 대한 전송 권한 부여를 가져오려면 [GetIdentityPolicy](https://docs.aws.amazon.com/ses/latest/APIReference/API_GetIdentityPolicy.html) 작업을 사용합니다.

 **가져옵니다**.

```
require 'vendor/autoload.php';

use Aws\Exception\AwsException;
use Aws\Ses\SesClient;
```

 **샘플 코드** 

```
$SesClient = new SesClient([
    'profile' => 'default',
    'version' => '2010-12-01',
    'region' => 'us-east-1'
]);

$identity = "arn:aws:ses:us-east-1:123456789012:identity/example.com";
$policies = ["policyName"];

try {
    $result = $SesClient->getIdentityPolicies([
        'Identity' => $identity,
        'PolicyNames' => $policies,
    ]);
    var_dump($result);
} catch (AwsException $e) {
    // output error message if fails
    echo $e->getMessage();
    echo "\n";
}
```

## 권한 있는 발신자 나열
<a name="list-authorized-senders"></a>

현재 AWSS 리전의 특정 이메일 보안 인증 또는 도메인 보안 인증과 연결된 전송 권한 부여 정책을 나열하려면 [ListIdentityPolicies](https://docs.aws.amazon.com/ses/latest/APIReference/API_ListIdentityPolicies.html) 작업을 사용합니다.

 **가져옵니다**.

```
require 'vendor/autoload.php';

use Aws\Exception\AwsException;
use Aws\Ses\SesClient;
```

 **샘플 코드** 

```
$SesClient = new SesClient([
    'profile' => 'default',
    'version' => '2010-12-01',
    'region' => 'us-east-1'
]);

$identity = "arn:aws:ses:us-east-1:123456789012:identity/example.com";

try {
    $result = $SesClient->listIdentityPolicies([
        'Identity' => $identity,
    ]);
    var_dump($result);
} catch (AwsException $e) {
    // output error message if fails
    echo $e->getMessage();
    echo "\n";
}
```

## 권한 있는 발신자의 권한 취소
<a name="revoke-permission-for-an-authorized-sender"></a>

[DeleteIdentityPolicy](https://docs.aws.amazon.com/ses/latest/APIReference/API_DeleteIdentityPolicy.html) 작업으로 연결된 보안 인증 정책을 삭제하여 이메일 보안 인증 또는 도메인 보안 인증으로 이메일을 전송할 수 있는 다른 AWS 계정 계정의 전송 권한 부여를 제거합니다.

 **가져옵니다**.

```
require 'vendor/autoload.php';

use Aws\Exception\AwsException;
use Aws\Ses\SesClient;
```

 **샘플 코드** 

```
$SesClient = new SesClient([
    'profile' => 'default',
    'version' => '2010-12-01',
    'region' => 'us-east-1'
]);

$identity = "arn:aws:ses:us-east-1:123456789012:identity/example.com";
$name = "policyName";

try {
    $result = $SesClient->deleteIdentityPolicy([
        'Identity' => $identity,
        'PolicyName' => $name,
    ]);
    var_dump($result);
} catch (AwsException $e) {
    // output error message if fails
    echo $e->getMessage();
    echo "\n";
}
```