lordkelvin
lordkelvin

Reputation: 13

Zend SMTP default settings

How to initialize Zend Mail SMTP settings and make them available for entire application.

Provided have configured settings in application.ini config file?

Thanks

Upvotes: 1

Views: 281

Answers (1)

d3bug3r
d3bug3r

Reputation: 2586

Add this code in Bootstrap.php file

 protected function _initMailConfig()
{
    $config = $this->getOptions();
    $host = $config['mail']['smtp']['host'];
    $fromEmail = $config['mail']['from']['email'];
    $fromName = $config['mail']['from']['name'];
    $transport = new Zend_Mail_Transport_Smtp($host);
    Zend_Mail::setDefaultTransport($transport);
    Zend_Mail::setDefaultFrom($fromEmail, $fromName);
}

also make sure you have predefined settings in application.ini config file

   mail.smtp.host = "smtp-host ip"
   mail.from.email = "[email protected]"
   mail.from.name = "example"

hope this helps you.

Upvotes: 1

Related Questions