

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

# Amazon SES API 및 AWS SDK for PHP 버전 3을 사용하여 발신 활동 모니터링
<a name="ses-send-email"></a>

Amazon Simple Email Service (Amazon SES)는 발신 활동을 모니터링하는 방법을 제공합니다. 이러한 방법을 사용하여 계정의 반송, 수신 거부 및 거부 발생률 같은 주요 지표를 추적하는 것이 좋습니다. 반송 메일 및 수신 거부 발생률이 지나치게 높으면 Amazon SES를 사용하여 이메일을 전송하는 데 어려움을 겪을 수 있습니다.

다음 예제에서는 다음과 같은 작업을 하는 방법을 보여줍니다.
+ [GetSendQuota](https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-email-2010-12-01.html#getsendquota)를 사용하여 발신 할당량 확인
+ [GetSendStatistics](https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-email-2010-12-01.html#getsendstatistics)를 사용하여 전송 활동 모니터링

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="check-your-sending-quota"></a>

단일 24시간 동안 특정 양의 메시지만 전송하도록 제한됩니다. 전송할 수 있는 메시지 수를 확인하려면 [GetSendQuota](https://docs.aws.amazon.com/ses/latest/APIReference/API_GetSendQuota.html) 작업을 사용합니다. 자세한 내용은 [Amazon SES 발신 한도 관리](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/manage-sending-limits.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'

]);

try {
    $result = $SesClient->getSendQuota();
    $send_limit = $result["Max24HourSend"];
    $sent = $result["SentLast24Hours"];
    $available = $send_limit - $sent;
    print("<p>You can send " . $available . " more messages in the next 24 hours.</p>");
    var_dump($result);
} catch (AwsException $e) {
    // output error message if fails
    echo $e->getMessage();
    echo "\n";
}
```

## 전송 활동 모니터링
<a name="monitor-your-sending-activity"></a>

지난 2주간 전송한 메시지에 대한 지표를 검색하려면 [GetSendStatistics](https://docs.aws.amazon.com/ses/latest/APIReference/API_GetSendStatistics.html) 작업을 사용합니다. 다음 예제에서는 15분 단위로 전송 시도, 반송, 수신 거부 및 거부된 메시지 수를 반환합니다.

 **가져옵니다**.

```
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'
]);

try {
    $result = $SesClient->getSendStatistics();
    var_dump($result);
} catch (AwsException $e) {
    // output error message if fails
    echo $e->getMessage();
    echo "\n";
}
```