Hi everybody, I’m new to the Zend / Laminas world so I don’t kow if this is the right question to do.
I’m trying to make some testing with laminas sending e-mails via SMTP, but can’t make it work.
use Laminas\Mail\Message;
use Laminas\Mail\Transport\Smtp as SmtpTransport;
use Laminas\Mail\Transport\SmtpOptions;
$transport = new SmtpTransport();
$options = new SmtpOptions(array(
'name' => 'my.smtp.com',
'host' => 'imap.gmail.com',
'port' => 995,
'connection_class' => 'login',
'connection_config' => array(
'ssl' => 'SSL',
'username' => 'my_mail@gmail.com',
'password' => 'my_password'
)
));
$transport->setOptions($options);
$message = new Message();
$transport->send($message);
It was just like in the examples, but when i run it I get this error:
PHP Fatal error: Uncaught Laminas\ServiceManager\Exception\ServiceNotFoundException:Unable to resolve service "Laminas\Mail\Protocol\Smtp\Auth\Login" to a factory; are you certain you provided it during configuration? in /ServiceManager.php:588
But I can’t find any reference anywhere that states that I have to define a factory for Smtp/Login.
And it is a Laminas internal class, I dont know what to do. Please, help!