Mail configuration using gmail

Hi,

Have someone configured mail with gmail? I have added the following configuration in local.config.php

	'mail' => [
        'transport' => [
            'type' => 'smtp',
            'options' => [
                'name' => 'gmail.com',
                'host' => 'smtp.gmail.com',
                'port' => '587', // 465 for 'ssl', and 587 for 'tls'
                'connection_class' => 'smtp', // 'plain', 'login', or 'crammd5'
                'connection_config' => [
                    'username' => 'user@gmail.com',
                    'password' => 'password',
                    'ssl' => 'tls', // 'ssl' or 'tls'
                    'use_complete_quit' => true,
                ],
            ],
        ],
    ],

but I always get the same error:
Laminas\Mail\Protocol\Exception\RuntimeException
5.7.0 Authentication Required. Learn more at 5.7.0 https://support.google.com/mail/?p=WantAuthError m9sm20600553wrs.36 - gsmtp

The user gmail account have “Less secure app access” on.
The Omeka admin email is the same that is setting in the connection_config.
I have also tried to change the port to 465 and the ssl property to “ssl”, but I get the same error.
Any idea what the problem is?

Thank you in advance!

Your connection_class should be one of plain, login or crammd5, as the comment suggests. I think “plain” would be the way to go. The smtp connection class is for, I believe, unauthenticated SMTP only.

Hi Jonh,

You are right. The problem was the connection_class. I set it to “plain” and it has worked.
I did not understand the meaning of this field and copied the value from the exemple of the Omeka user manual and some Omeka forum post. Sorry for the inconvenience and thank you very much!

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.