首页 > 解决方案 > Laravel8 sendmail 驱动程序无法正常工作

问题描述

我想问一下我的 .env 和 mail.php 是否正确。我已经检查了这里所有相关的问题,但到目前为止,所有这些问题都导致我出现同样的错误。下面是错误信息

无法启动进程 [系统找不到指定的路径。] {"exception":"[object] (Swift_TransportException(code: 0): Process could not be started [The system cannot find the path specified.] at C:\xampp4\htdocs\payroll\vendor\swiftmailer\swiftmailer\lib \classes\Swift\Transport\StreamBuffer.php:294)

这是我的 .env 文件

MAIL_MAILER=sendmail
MAIL_SENDMAIL='/usr/sbin/sendmail -t -i'

这是我的mail.php

<?php

return [
    'default' => env('MAIL_MAILER', 'smtp'),
    'sendmail' => env('MAIL_SENDMAIL', '/usr/sbin/sendmail -bs'),

    'mailers' => [
        'smtp' => [
            'transport' => 'smtp',
            'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
            'port' => env('MAIL_PORT', 2525),
            'encryption' => env('MAIL_ENCRYPTION', 'tls'),
            'username' => env('MAIL_USERNAME'),
            'password' => env('MAIL_PASSWORD'),
            'timeout' => null,
            'auth_mode' => null,
        ],

        'ses' => [
            'transport' => 'ses',
        ],

        'mailgun' => [
            'transport' => 'mailgun',
        ],

        'postmark' => [
            'transport' => 'postmark',
        ],

        'sendmail' => [
            'transport' => 'sendmail',
            'path' => env('MAIL_SENDMAIL', '/usr/sbin/sendmail -bs'),
        ],

        'log' => [
            'transport' => 'log',
            'channel' => env('MAIL_LOG_CHANNEL'),
        ],

        'array' => [
            'transport' => 'array',
        ],
    ],

    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
        'name' => env('MAIL_FROM_NAME', 'Example'),
    ],


    'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],

];

标签: phplaravelsendmaillaravel-mail

解决方案


推荐阅读