LoginSignup
7
4

More than 3 years have passed since last update.

【Laravel】MAIL_DRIVER=sendmail, MAIL_DRIVER=smtp の違い。PHPのmail関数の挙動。

Posted at

Laravelのmailableクラスでメール送信を行う[導入/入門編]

smtp
SMTPサーバーから送信する。一般的な送信方法。
sendmail
PHPのmail関数で送信する。

PHP: mail - Manual

mail関数はSMTPから送信していないのか?

PHP: 実行時設定 - Manual

php.ini の設定により動作が変化します。

sendmail_path に設定しているパスが呼ばれる

Windows環境の場合はsendmail_pathが設定されていなければ
SMTPに設定されているSMTP サーバーのホスト名または IP アドレス(デフォルトではlocalhost)に
smtp_port設定で指定したサーバーに接続するポート番号(デフォルトは25)で接続する。

Linuxのsendmailコマンド

MAT(メールサーバー)からメールが送信される。

sendmailコマンドの使い方: UNIX/Linuxの部屋

Linux - メール転送エージェント(MTA)の基本

sendmailとは|「分かりそう」で「分からない」でも「分かった」気になれるIT用語辞典

結論

メールを送信する以上はSMTPサーバーから送信している。
SMTPサーバーに直接接続するか、PHPのmail関数の設定に任せるかの違い。
ってことでいいのかな?

7
4
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
7
4