Skip to content

Commit

Permalink
[BF] Try to fix Zend SMTP based on Laravel config
Browse files Browse the repository at this point in the history
  • Loading branch information
barryo committed Jan 22, 2018
1 parent e0c2cc8 commit 0f8e802
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion app/Providers/ZendFrameworkServiceProvider.php
Expand Up @@ -379,7 +379,15 @@ private function setupLogger( array $options ): array {
* Setup mailer
*/
private function setupMailer( array $options ): array {
$options['ondemand_resources']['mailer']['smtphost'] = config('mail.host');

$options['resources']['mailer']['smtphost'] = config('mail.host');

$options['resources']['mailer']['port'] = config('mail.port',null) ?? 25;

$options['resources']['mailer']['auth'] = config('mail.auth',null);
$options['resources']['mailer']['username'] = config('mail.username',null);
$options['resources']['mailer']['password'] = config('mail.password',null);

return $options;
}

Expand Down
6 changes: 5 additions & 1 deletion library/OSS/Resource/Mailer.php
Expand Up @@ -77,7 +77,7 @@ public function getMailer()

if( count( $options ) )
{
if( isset( $options['auth'] ) )
if( isset( $options['auth'] ) && $options['auth'] )
{
$config = array(
'auth' => $options['auth'],
Expand All @@ -88,6 +88,10 @@ public function getMailer()
else
$config = array();

if( isset( $options['port'] ) ) {
$config['port'] = $options['port'];
}

$transport = new Zend_Mail_Transport_Smtp( $options['smtphost'], $config );
Zend_Mail::setDefaultTransport( $transport );

Expand Down

0 comments on commit 0f8e802

Please sign in to comment.