laravel - Laravel mail error: Class 'Swift_StreamFilters_StringReplacementFilter' not found
问题描述
Using Laravel 8. Unable to send mail after contact info inserted into DB.
I cannot find any clues online as to how to resolve this error. Everything works on my machine with MailTrap, but not on the live server. With mail code commented out, it works fine. No typos on email address or password. Same issue posted but no replies.
My .env is configured as follows:
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
Throws this error:
Class 'Swift_StreamFilters_StringReplacementFilter' not found
When I comment out the mail code, everything works (contact info inserted into DB). What fails is emailing the data from the form saved like this:
$data = Contact::create($validatedAttributes);
Attempting to mail:
Mail::to(request('email'))
->send(new ContactForm($data));
The ContactForm mailable instance:
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');
}
}
The markdown template (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
Everything works in MailTrap but not on the server at InMotion Hosting.
Any assistance to identify my error(s) is appreciated.
解决方案
Error 文件上传错误到主机服务器的结果。
推荐阅读
- python - Python从列表名称而不是列表项返回字符
- javascript - 使用 Python 对 Javascript 表(带有网格和列表视图)进行 Web 抓取 - Beautiful Soup
- javascript - 在函数内部使用 setTimeout
- laravel - 如何在 laravel Searchy 扩展中应用分页
- url - XSS 和友好的 URL
- hyperlink - 指向超链接标题的内部链接
- python - Web Scraper 功能未抓取新数据
- swift - ScrollView 在自定义基于手势的上滑卡中导致 SwiftUI 出现问题
- python - 多个 URL 抓取 YouTube
- java - 执行wait()后,一个线程如果没有得到其他线程的通知,要等待多长时间?