Я не могу отправлять электронную почту со своего SMTP. Я получаю эту ошибку каждый раз, когда мой веб-сайт отправляет электронное письмо.
Ошибка исчезла после того, как я изменил почтовый драйвер на "sendmail"
. Это ошибка, которую я получаю, если использую SMTP в качестве почтового драйвера:
ErrorException in EsmtpTransport.php line 289:
Call to undefined method setBcc
in EsmtpTransport.php line 289
at HandleExceptions->handleError('256', 'Call to undefined method setBcc', '/home/goframe/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php', '289', array('method' => 'setBcc', 'args' => array('sales@goframe.id'), 'handler' => object(Swift_Transport_Esmtp_AuthHandler)))
at trigger_error('Call to undefined method setBcc', '256') in EsmtpTransport.php line 289
at Swift_Transport_EsmtpTransport->__call('setBcc', array('sales@goframe.id')) in Setting.php line 43
at Setting::setMailFrom('support@goframe.id', '') in PasswordReset.php line 37
at PasswordReset->build()
at call_user_func_array(array(object(PasswordReset), 'build'), array()) in Container.php line 508
at Container->call(array(object(PasswordReset), 'build')) in Mailable.php line 109
at Mailable->send(object(Mailer)) in Mailer.php line 192
at Mailer->send(object(PasswordReset)) in MailableMailer.php line 99
at MailableMailer->send(object(PasswordReset)) in Member.php line 39
at Member->sendPasswordResetNotification('8add9f4862469b750e4d5fef31c64a32e23d51aa899e12fa4de1616f2ad95fd4') in PasswordBroker.php line 70
at PasswordBroker->sendResetLink(array('email' => 'ronaldsunrise@gmail.com')) in SendsPasswordResetEmails.php line 34
at MemberForgotPasswordController->sendResetLinkEmail(object(Request), 'id')
at call_user_func_array(array(object(MemberForgotPasswordController), 'sendResetLinkEmail'), array(object(Request), 'language' => 'id')) in Controller.php line 55
at Controller->callAction('sendResetLinkEmail', array(object(Request), 'language' => 'id')) in ControllerDispatcher.php line 44
at ControllerDispatcher->dispatch(object(Route), object(MemberForgotPasswordController), 'sendResetLinkEmail') in Route.php line 189
at Route->runController() in Route.php line 144
Это моя настройка. php код:
namespace App\Helper;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail;
class Setting
{
const MAIL_SALES_NAME = 'Goframe Sales';
const MAIL_SALES_FROM = 'sales@goframe.id';
const MAIL_SALES_PASSWORD = '**********';
const MAIL_SUPPORT_NAME = 'Goframe Support';
const MAIL_SUPPORT_FROM = 'support@goframe.id';
const MAIL_SUPPORT_PASSWORD = '************';
public static function get($name)
{
$ret = DB::select('SELECT `value` FROM settings WHERE `key` = ? LIMIT 1', [$name]);
if (!$ret) throw new \InvalidArgumentException('Setting with name "'.$name.'" not found');
return $ret[0]->value;
}
public static function setMailFrom($address, $password)
{
if (Config::get('mail.driver') != 'smtp') return;
$transport = \Swift_SmtpTransport::newInstance(
Config::get('mail.host'), Config::get('mail.port'), Config::get('mail.encryption')
);
$transport->setUsername($address);
$transport->setPassword($password);
$transport->setBcc('sales@goframe.id');
$transport->setBcc('accounting@goframe.id');
$swift = new \Swift_Mailer($transport);
Mail::setSwiftMailer($swift);
}
public static function __callStatic($name, $args)
{
return self::get($name);
Как исправить эту ошибку?