Skip to content

Instantly share code, notes, and snippets.

@juizmill
Last active December 24, 2015 03:29
Show Gist options
  • Save juizmill/6737354 to your computer and use it in GitHub Desktop.
Save juizmill/6737354 to your computer and use it in GitHub Desktop.
Exemplo de como recuperar dados de configuração direto do global.php ou local.php
<?php
/**
* Global Configuration Override
*
* You can use this file for overriding configuration values from modules, etc.
* You would place values in here that are agnostic to the environment and not
* sensitive to security.
*
* @NOTE: In practice, this file will typically be INCLUDED in your source
* control, so do not include passwords or other sensitive information in this
* file.
*/
return array(
'mail' => array(
'name' => 'smtp.gmail.com', #SMTP do servidor de e-mail
'host' => 'smtp.gmail.com', #No google só repetir o SMTP
'port' => 465, #Porta do servidor de e-mail
'connection_class' => 'login', #Diz que será feito uma autenticação para disparar os e-mail
'connection_config' => array(
'from' => 'teste@gmail.com', # DE!
'username' => 'teste@gmail.com', #E-Mail de autenticação
'password' => '12345', #Senha do e-mail para autenticar
'ssl' => 'ssl', #Tipo do envio
)
),
);
<?php
public function getServiceConfig()
{
return array(
'factories' => array(
'Contato\Mail\Transport' => function($sm) {
$config = $sm->get('Config');
$transport = new SmtpTransport;
$options = new SmtpOptions($config['mail']);
$transport->setOptions($options);
return $transport;
},
'Contato\Service\Contato' => function($sm) {
return new Service\Contato($sm->get('Contato\Mail\Transport'),$sm->get('View'));
}
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment