0

I'm currently working on an app with Zend Framework 3 hosted in OVH. I'm trying to send mail with Zend_Mail but without success... so here is my code :

$message = new Message();
$message->addTo('client_name@gmail.com')
        ->addFrom('email_account@host.com')
        ->setSubject('Test subject!')
        ->setBody("Test Body!");

// Setup SMTP transport using LOGIN authentication
$transport = new SmtpTransport();
$options   = new SmtpOptions();

$transport->setOptions($options);
$transport->send($message);

And In my SmtpOptions.php file :

protected $name = 'OVH';

/**
 * @var string
 */
protected $connectionClass = 'smtp';

/**
 * Connection configuration (passed to the underlying Protocol class)
 *
 * @var array
 */
protected $connectionConfig = [
   'ssl'      => 'ssl',
   'auth'     => 'login',
   'username' => 'my_username',
   'password' => 'my_pass'
];

/**
 * @var string Remote SMTP hostname or IP
 */
protected $host = 'ssl0.ovh.net';

/**
 * @var int
 */
protected $port = 465;

I've got an 5.7.1: access denied error and i can't figure out why ? Any help would be appreciate ! :) Let me know if it's not clear or if you need other informations.

  • `Zend_Mail` or `zendframework/zend-mail` ? You've tagged ZF1 & ZF 3, you're asking about ZF1 Mail module but are showing code for ZF3. In this case, please include versions of what it is you're using and be more specific. Have you also used xdebug to step through the code execution to see where an error is thrown? I'm assuming that it can connect, based on the message, and that you're credentials are incorrect. But without more specifics and more detail, not really possible to say more. – rkeet Sep 08 '18 at 13:32
  • @rkeet Thanks for your answer, my bad i assumed that the zend-framework tag was global and not for the 1.0 version. I'm using indeed the ZF3 version. I didn't used xdebug, i will try it and come bak if i can solve the issue :) (I doubled check my credentials and they're good.) – Maxime Guiton Sep 13 '18 at 12:20

0 Answers0