Я использую расширенный шаблон yii2 и столкнулся с проблемой при регистрации при отправке электронной почты.Я использовал mailtrap для отправки электронной почты и включил все детали в общий / config / mainlocal-php.Использование Xampp в качестве хоста.
maillocal.php выглядит следующим образом:
<?php
return [
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=advanced_yii2',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
],
'mail' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail',
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.mailtrap.io',
'username' => '9**************e',
'password' => '7***************5',
'port' => '2525',
'encryption' => 'tls',
],
],
],
];
This is the error i am getting.
Swift_TransportException
Process could not be started [The system cannot find the path specified.
]
1. in C:\xampp\htdocs\yii-application\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php at line 299
2. in C:\xampp\htdocs\yii-application\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php at line 54 – Swift_Transport_StreamBuffer::establishProcessConnection()
3. in C:\xampp\htdocs\yii-application\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php at line 143 – Swift_Transport_StreamBuffer::initialize(['timeout' => 30, 'blocking' => 1, 'command' => '/usr/sbin/sendmail -bs', 'type' => 16])
4. in C:\xampp\htdocs\yii-application\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\SendmailTransport.php at line 50 – Swift_Transport_AbstractSmtpTransport::start()
5. in C:\xampp\htdocs\yii-application\vendor\yiisoft\yii2-swiftmailer\src\Mailer.php at line 113 – Swift_Transport_SendmailTransport::start()
6. in C:\xampp\htdocs\yii-application\vendor\yiisoft\yii2-swiftmailer\src\Mailer.php at line 156 – yii\swiftmailer\Mailer::getSwiftMailer()
7. in C:\xampp\htdocs\yii-application\vendor\yiisoft\yii2\mail\BaseMailer.php at line 263 – yii\swiftmailer\Mailer::sendMessage(yii\swiftmailer\Message)
8. in C:\xampp\htdocs\yii-application\vendor\yiisoft\yii2\mail\BaseMessage.php at line 49 – yii\mail\BaseMailer::send(yii\swiftmailer\Message)
9. in C:\xampp\htdocs\yii-application\frontend\models\SignupForm.php at line 77 – yii\mail\BaseMessage::send()
10. in C:\xampp\htdocs\yii-application\frontend\models\SignupForm.php at line 57 – frontend\models\SignupForm::sendEmail(common\models\User)
11. in C:\xampp\htdocs\yii-application\frontend\controllers\SiteController.php at line 156 – frontend\models\SignupForm::signup()
12. frontend\controllers\SiteController::actionSignup()
13. in C:\xampp\htdocs\yii-application\vendor\yiisoft\yii2\base\InlineAction.php at line 57 – call_user_func_array([frontend\controllers\SiteController, 'actionSignup'], [])
14. in C:\xampp\htdocs\yii-application\vendor\yiisoft\yii2\base\Controller.php at line 157 – yii\base\InlineAction::runWithParams(['r' => 'site/signup'])
15. in C:\xampp\htdocs\yii-application\vendor\yiisoft\yii2\base\Module.php at line 528 – yii\base\Controller::runAction('signup', ['r' => 'site/signup'])
16. in C:\xampp\htdocs\yii-application\vendor\yiisoft\yii2\web\Application.php at line 103 – yii\base\Module::runAction('site/signup', ['r' => 'site/signup'])
17. in C:\xampp\htdocs\yii-application\vendor\yiisoft\yii2\base\Application.php at line 386 – yii\web\Application::handleRequest(yii\web\Request)
18. in C:\xampp\htdocs\yii-application\frontend\web\index.php at line 17 – yii\base\Application::run()