2019年1月22日火曜日

AWS SESのsendRawEmailでスパム判定されてしまう件

sendRawEmailで添付ファイル付きのメールを送信したところ 以下のようなエラーで送信に失敗しました。 550-5.7.1 not RFC 5322 compliant: 550-5.7.1 'From' header is missing. 550-5.7.1 To reduce the amount of spam sent to Gmail, this message has been
$result = $SesClient->sendRawEmail([
        'Destinations' => [$to],
        'Source' => $from,
        'RawMessage' => [
            'Data' => base64_encode($message)
        ],
]);
このbase64_encodeがいけないようで外したところうまく動作しました。