10
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Laravel RFC違反しているメールアドレスをサクッと探すtips

Last updated at Posted at 2019-09-10

メール送信処理でRFC違反のメールアドレスが混じっていたため、メール送信エラーとなりました。
とりあえず、どのメールアドレスが規約違反になっているのか知りたかったのでtinkerでサクッと探せるコードを用意しました。

$ php artisan tinker
\App\User::pluck('email', 'id')->each(function ($email, $id) {
    try {
        \Validator::validate(['email' => $email], ['email' => ['email', 'nullable']]);
    } catch (\Exception $e) {
        echo sprintf('users.id: %d, users.email: %s, error: %s', $id, $email, $e->getMessage()) . PHP_EOL;
    }
})->count();

続編

続きの記事を書きました!

Laravel RFC違反のメールアドレスにメール送信できるようにする

10
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?