SMTP Mail setup

I’m setting up Omeka-S for the first time and I’m working on the mail configuration. I’m getting closer, but when trying to send a password reset email, I get:

Laminas\ServiceManager\Exception\ServiceNotCreatedException
Service with name “Omeka\Mailer” could not be created. Reason: The option “mail” does not have a callable “setMail” (“setmail”) setter method which must be defined

I have authorization to use an smtp server and I’m using these options:


 'mail' => [
        'transport' => [
            'type' => 'smtp',
            'options' => [
                'name' => 'smtp.utk.edu',
                'host' => '160.36.241.242',
                'port' => '25', // 465 for 'ssl', and 587 for 'tls'
                'connection_class' => 'smtp', // 'plain', 'login', or 'crammd5'
                'connection_config' => [
                    'username' => null,
                    'password' => null,
                    'ssl' => 'tls', // 'ssl' or 'tls'
                    'use_complete_quit' => true,
                ],

What am I missing here? Thanks for any clues.

Can you send your entire local.config.php file? Maybe there’s something awry elsewhere in there.

Here’s the code. I tried to attach it as a text file., but new users can’t upload files it seems. With all the brackets I have no idea if I’m getting syntax right or not.

<?php
return [
    'logger' => [
        'log' => false,
        'priority' => \Laminas\Log\Logger::NOTICE,
    ],
    'http_client' => [
        'sslcapath' => null,
        'sslcafile' => null,
    ],
    'cli' => [
        'phpcli_path' => null,
    ],
    'thumbnails' => [
        'types' => [
            'large' => ['constraint' => 800],
            'medium' => ['constraint' => 200],
            'square' => ['constraint' => 200],
        ],
        'thumbnailer_options' => [
            'imagemagick_dir' => null,
        ],
    ],
    'translator' => [
        'locale' => 'en_US',
    ],
    'service_manager' => [
        'aliases' => [
            'Omeka\File\Store' => 'Omeka\File\Store\Local',
            'Omeka\File\Thumbnailer' => 'Omeka\File\Thumbnailer\ImageMagick',
        ],
    ],

 'mail' => [
        'transport' => [
            'type' => 'smtp',
            'options' => [
                'name' => 'smtp.utk.edu',
                'host' => '160.36.241.242',
                'port' => '25', // 465 for 'ssl', and 587 for 'tls'
                'connection_class' => 'smtp', // 'plain', 'login', or 'crammd5'
                'connection_config' => [
                    'username' => null,
                    'password' => null,
                    'ssl' => 'tls', // 'ssl' or 'tls'
                    'use_complete_quit' => true,
                ],

    'mail' => [
       'default_message_options' => [
           'from' => 'sistech@utk.edu',
        ],
    ],
            ],
        ],
    ],
];

Your problem is going to be that you have two mail keys, one inside the other.

The mail part of your file looks like this:

 'mail' => [
        'transport' => [
            'type' => 'smtp',
            'options' => [
                'name' => 'smtp.utk.edu',
                'host' => '160.36.241.242',
                'port' => '25', // 465 for 'ssl', and 587 for 'tls'
                'connection_class' => 'smtp', // 'plain', 'login', or 'crammd5'
                'connection_config' => [
                    'username' => null,
                    'password' => null,
                    'ssl' => 'tls', // 'ssl' or 'tls'
                    'use_complete_quit' => true,
                ],

    'mail' => [
       'default_message_options' => [
           'from' => 'sistech@utk.edu',
        ],
    ],
            ],
        ],
    ],

and if we fix the indentation it’s more clear what you actually have there:

    'mail' => [
        'transport' => [
            'type' => 'smtp',
            'options' => [
                'name' => 'smtp.utk.edu',
                'host' => '160.36.241.242',
                'port' => '25', // 465 for 'ssl', and 587 for 'tls'
                'connection_class' => 'smtp', // 'plain', 'login', or 'crammd5'
                'connection_config' => [
                    'username' => null,
                    'password' => null,
                    'ssl' => 'tls', // 'ssl' or 'tls'
                    'use_complete_quit' => true,
                ],
                'mail' => [
                    'default_message_options' => [
                        'from' => 'sistech@utk.edu',
                    ],
                ],
            ],
        ],
    ],

The upshot being that you have accidentally put that extra “mail” section inside the list of options; this is why the error message is complaining about ‘the option “mail”.’

The manual has examples for both setting up SMTP and setting a From address, but the intent is that there’s only one “mail” section, and if you need both the SMTP settings and the From address, that you’d combine them into one, like this:

    'mail' => [
        'transport' => [
            'type' => 'smtp',
            'options' => [
                'name' => 'smtp.utk.edu',
                'host' => '160.36.241.242',
                'port' => '25', // 465 for 'ssl', and 587 for 'tls'
                'connection_class' => 'smtp', // 'plain', 'login', or 'crammd5'
                'connection_config' => [
                    'username' => null,
                    'password' => null,
                    'ssl' => 'tls', // 'ssl' or 'tls'
                    'use_complete_quit' => true,
                ],
            ],
        ],
        'default_message_options' => [
            'from' => 'sistech@utk.edu',
        ],
    ],

Thanks. I didn’t pick up on the fact that mail was a section and that there was only supposed to one of them. I’m not getting the error anymore so that’s progress. However once I click the Send password reset email button I get two contradictory messages on the next screen:

  • Unable to send password reset email. (in yellow)
  • Check your email for instructions on how to reset your password (in green)

So I’m guessing that I might not actually be authorized to send email from my domain (dl.infosci.utk.edu) and I’ll need to check with my campus central IT.