Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swiftmailer not send mail gets Not Acceptable (#406) #15109

Closed
mavs1971 opened this issue Nov 6, 2017 · 3 comments
Closed

Swiftmailer not send mail gets Not Acceptable (#406) #15109

mavs1971 opened this issue Nov 6, 2017 · 3 comments
Labels

Comments

@mavs1971
Copy link

mavs1971 commented Nov 6, 2017

i have a app that send recorerypassword mail to client, when they forgot . i was working fine, but last week it´s start to throw a exception #406.

logs file have
exception 'yii\web\NotAcceptableHttpException' with message '......' in \yii2-user\models\AccountRecoverPasswordForm.php:51
Stack trace:
#0 \yii2-user\controllers\RecoveryController.php(54):
\user\models\AccountRecoverPasswordForm->recoverPassword()
#1 [internal function]:RecoveryController->actionRecoverPassword()
#2 D:\matarile\clubs\vendor\yiisoft\yii2\base\InlineAction.php(55): call_user_func_array(Array, Array)
#3 D:\matarile\clubs\vendor\yiisoft\yii2\base\Controller.php(154): yii\base\InlineAction->runWithParams(Array)
#4 D:\matarile\clubs\vendor\yiisoft\yii2\base\Module.php(454): yii\base\Controller->runAction('recover-passwor...', Array)
#5 D:\matarile\clubs\vendor\yiisoft\yii2\web\Application.php(84): yii\base\Module->runAction('user/recovery/r...', Array)
#6 D:\matarile\clubs\vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#7 D:\matarile\clubs\index.php(18): yii\base\Application->run()
#8 {main}

the line that send the exception it´s

try {
// Send Welcome Message to activate the account
Mailer::sendRecoveryMessage($user);
} catch (\Swift_TransportException $e) {
throw new NotAcceptableHttpException("..... "
. Yii::$app->config->get('movil', 'administrador'));
}

the rutine it´s

protected function sendMail($to, $subject, $view, $params = [])
{
$parametros = Configuration::getParam();

		if ($parametros['useTransport']==true) {
			$mailer           = Yii::$app->mail;
		} else {
			$mailer           = Yii::$app->mailer;
		}

              
		$mailer->viewPath = '@abhimanyu/user/views/mail';

		return $mailer->compose(['html' => $view, 'text' => 'text/' . $view], $params)
			->setTo($to)
			->setFrom(Yii::$app->config->get('mail.username'), '[email protected]')
			->setSubject($subject)
			->send();
	}

please help... don´t kwon what happen

@mavs1971
Copy link
Author

mavs1971 commented Nov 6, 2017

sorry the config file for swiftmailer

'mail' =>
array (
'class' => 'yii\swiftmailer\Mailer',
'transport' =>
array (
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.gmail.com',
'username' => '[email protected]',
'password' => 'xxxxx',
'port' => '465',
'encryption' => 'ssl',
),
),

@cebe
Copy link
Member

cebe commented Nov 6, 2017

you should log the details of what is in $e, the \Swift_TransportException it should show you the cause of the error. If you need further help, see below.

@cebe cebe added the question label Nov 6, 2017
@yii-bot
Copy link

yii-bot commented Nov 6, 2017

Thank you for your question.
In order for this issue tracker to be effective, it should only contain bug reports and feature requests.

We advise you to use our community driven resources:

If you are confident that there is a bug in the framework, feel free to provide information on how to reproduce it. This issue will be closed for now.

This is an automated comment, triggered by adding the label question.

@yii-bot yii-bot closed this as completed Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants