私はこれを試しましたが、私にとってはうまくいきませんでした。 https://stackoverflow.com/questions/10537318/how-to-use-the-di-for-zend-mail-transport-smtp
Zend フレームワーク 2.0.3dev を使用しています
私はこれを試しましたが、私にとってはうまくいきませんでした。 https://stackoverflow.com/questions/10537318/how-to-use-the-di-for-zend-mail-transport-smtp
Zend フレームワーク 2.0.3dev を使用しています
私にとって、これはGoogleアプリのメールアドレスで機能しました
config/autoload/mail.local.php
return array(
'mail' => array(
'transport' => array(
'options' => array(
'host' => 'smtp.gmail.com',
'connection_class' => 'plain',
'connection_config' => array(
'username' => 'example@example.org',
'password' => '',
'ssl' => 'tls'
),
),
),
),
);
そしてModule.php
public function getServiceConfig()
{
return array(
'factories' => array(
'mail.transport' => function (ServiceManager $serviceManager) {
$config = $serviceManager->get('Config');
$transport = new Smtp();
$transport->setOptions(new SmtpOptions($config['mail']['transport']['options']));
return $transport;
},
),
);
}
そしてコントローラーで
$transport = $this->getServiceLocator()->get('mail.transport');
このコードが誰かの役に立つことを願っています:D