【问题标题】:Laravel mail error: Class 'Swift_StreamFilters_StringReplacementFilter' not foundLaravel 邮件错误:找不到类 'Swift_StreamFilters_StringReplacementFilter'
【发布时间】:2021-03-09 13:25:04
【问题描述】:

使用 Laravel 8。将联系信息插入数据库后无法发送邮件。

我在网上找不到有关如何解决此错误的任何线索。一切都可以在我的机器上使用 MailTrap,但不能在实时服务器上。注释掉邮件代码后,它工作正常。电子邮件地址或密码没有拼写错误。 Same issue posted but no replies.

错误截图

我的.env配置如下:

MAIL_MAILER=smtp
MAIL_HOST=secure279.inmotionhosting.com
MAIL_PORT=465
MAIL_USERNAME=full_email_address
MAIL_PASSWORD=password
MAIL_ENCRYPTION=SSL
MAIL_FROM_ADDRESS=full_email_address

抛出此错误:

Class 'Swift_StreamFilters_StringReplacementFilter' not found 

当我注释掉邮件代码时,一切正常(联系信息插入数据库)。失败的是从这样保存的表单中通过电子邮件发送数据:

$data = Contact::create($validatedAttributes);

正在尝试邮寄:

Mail::to(request('email'))
     ->send(new ContactForm($data));

ContactForm 可邮寄实例:

class ContactForm extends Mailable
{
    use Queueable, SerializesModels;

    public $data;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($data)
    {
        $this->data = $data;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->markdown('emails.contact-form');
    }
}

降价模板(电子邮件/联系表单):

@component('mail::message')
# You received a contact form submission from {{ $data->first_name }}.

Here are the details: 
- Name: {{ $data->first_name }} {{ $data->last_name }}
- Email: {{ $data->email }}
- Message: {{ $data->message }}


Thanks,<br>
{{ config('app.name') }}
@endcomponent

在 MailTrap 中一切正常,但在 InMotion Hosting 的服务器上却不行。

感谢您提供任何帮助以识别我的错误。

【问题讨论】:

    标签: laravel email


    【解决方案1】:

    Error 文件上传错误的结果到主机服务器。

    【讨论】:

      猜你喜欢
      • 2019-08-08
      • 2015-12-29
      • 2016-11-26
      • 2023-03-04
      • 2017-11-07
      • 2021-02-19
      • 2013-03-12
      • 2019-10-07
      • 1970-01-01
      相关资源
      最近更新 更多