Hi,
I am trying to send mails from production site but mails always arrive in runtime/mail folder
public function actionTestmail()
{
Yii::$app
->mailer
->compose(['html' => 'courriel-test-html']
)
->setFrom("user@domain.fr") //->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])
->setTo('me@mydomain.com')
->setSubject('Email for test purpose')
->send();
return $this->render('index');
}
<?php
index.php
// comment out the following two lines when deployed to production
//defined('YII_DEBUG') or define('YII_DEBUG', true);
//defined('YII_ENV') or define('YII_ENV', 'dev');
require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
$config = require(__DIR__ . '/../config/web.php');
(new yii\web\Application($config))->run();
[b]
config/web.php[/b]
'Smtpmail'=>array(
'class'=>'application.extensions.smtpmail.PHPMailer',
'useFileTransport' => false,
'Host'=>"fox.o2switch.net",
'Username'=>'user@domain.fr',//a valid account
'Password'=>'******',//the actual password for the account above
'Mailer'=>'smtp',
'Port'=>587,
'SMTPAuth'=>true,
'SMTPSecure' => 'tls',
),
or
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'fox.o2switch.net',
'username' => 'user@domain.fr',
'password' => '*******',
'port' => '25',
// 'encryption' => 'tls',
],
],
In both cases the result is the same, a file in runtime/mail but no mail actually sent