Test and verify email settings adress failed

Hi

Have a synology/portainer/docker/Nextcloud installation 6 (27.1.3)
I have a problem to setup Email server in Basic settings.
Always running into error message:

A problem occurred while sending the email. Please revise your settings. (Error: Email could not be sent. Check your mail server log)

Tried with gmail and yahoo address. Both accounts 2-factor authorized.
Meaning created passwords and use it in the credential part.

Found in the docs that setting
ā€˜mail_smtpdebugā€™ => true,
in config/config.php would give some details about the problem.

Logged in and set the parameter.
Verified also the credentials in there entered via GUI.

But the GUI does not show anything at all.

Any advice how to proceed would be appreciated.
Thank you

27.11.2023 added:
After digging in the docs found link:
[https://docs.nextcloud.com/server/21/admin_manual/configuration_server/logging_configuration.html?highlight=log%20file]
So I set also
ā€œlog_typeā€ => ā€œfileā€,
ā€œlogfileā€ => ā€œnextcloud.logā€,
Then I got error messages in the GUI.

Next step is: I have to figure out the meaning :stuck_out_tongue_winking_eye:

Iā€™m having the same issue. Iā€™ve done this a million times without error. I needed to recreate my nextcloud docker container and now I am mystified. Iā€™m using a gmail account (tried non gmail and no go).

GMail needs to be enabled for remote clients in the Google account for security reason.
Please also check, whether really SSL-encryption will be needed, or TLS is required.

The access of non-ā€œcertifiedā€ mail clients will be disabled by Google after several weeks or months and needs to be re-enabled manually in the Google account again.

2 Likes

I have no idea where to find that setting(s). Also, this didnā€™t work with a non-gmail account either.

Maybe this guide may help you:
https://mailmeteor.com/blog/gmail-smtp-settings

2 Likes

Did not help. Iā€™m not trying to setup an email client. Iā€™ve been using nextcloud since version 12 and never had this problem, why this issue started I have no idea.

Nextcloud sends itā€™s emails the same way an email client does.

A likely issue might be your docker container is missing some CAā€™s or the container is seeing the wrong IP address and canā€™t verify the STARTTLS cert. Add this to your config and verify:

"mail_smtpstreamoptions" => array(
    'ssl' => array(
        'allow_self_signed' => true,
        'verify_peer' => false,
        'verify_peer_name' => false
    )
),

Source:

https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/email_configuration.html#how-can-i-send-mail-using-self-signed-certificates-or-use-starttls-with-self-signed-certificates

Iā€™m not using a self-signed cert.

Itā€™s not your cert itā€™s ignoring errors on but the email servers. Give it a try before dismissing, For whatever reason itā€™s possible for your nextcloud instance to be unable to verify the email serverā€™s cert and so the TLS handshake fails. Iā€™ve done this with a Microsoft exchange server in the past

Hi

Finally try to understand the call stack:

[core] Debug: Symfony\Component\Mailer\Exception\TransportException: Expected response code ā€œ250ā€ but got code ā€œ550ā€, with message ā€œ550 Request failed; Mailbox unavailableā€. at <>

  1. /var/www/html/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php line 182
    Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->assertResponseCode(ā€œ550 Request fai ā€¦ nā€, [250])
  2. /var/www/html/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php line 235
    Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->executeCommand(ā€œMAIL FROM:\r\nā€, [250])
  3. /var/www/html/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php line 199
    Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->doMailFromCommand(ā€œMyEmailAddressā€)
  4. /var/www/html/3rdparty/symfony/mailer/Transport/AbstractTransport.php line 72
    Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->doSend(["Symfony\Compo ā€¦ "])
  5. /var/www/html/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php line 136
    Symfony\Component\Mailer\Transport\AbstractTransport->send(["Symfony\Compo ā€¦ "], ["Symfony\Compo ā€¦ "])
  6. /var/www/html/3rdparty/symfony/mailer/Mailer.php line 45
    Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->send([ā€œSymfony\Component\Mime\Emailā€], null)
  7. /var/www/html/lib/private/Mail/Mailer.php line 216
    Symfony\Component\Mailer\Mailer->send([ā€œSymfony\Component\Mime\Emailā€])
  8. /var/www/html/apps/settings/lib/Controller/MailSettingsController.php line 168
    OC\Mail\Mailer->send([ā€œOC\Mail\Messageā€])
  9. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 230
    OCA\Settings\Controller\MailSettingsController->sendTestMail()
  10. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 137
    OC\AppFramework\Http\Dispatcher->executeController(["OCA\Settings\ ā€¦ "], ā€œsendTestMailā€)
  11. /var/www/html/lib/private/AppFramework/App.php line 183
    OC\AppFramework\Http\Dispatcher->dispatch(["OCA\Settings\ ā€¦ "], ā€œsendTestMailā€)
  12. /var/www/html/lib/private/Route/Router.php line 315
    OC\AppFramework\App::main(ā€œOCA\Settings\ ā€¦ rā€, ā€œsendTestMailā€, ["OC\AppFramewo ā€¦ "], [ā€œsettings.MailSettings.sendTestMailā€])
  13. /var/www/html/lib/base.php line 1068
    OC\Route\Router->match(ā€œ/settings/admin/mailtestā€)
  14. /var/www/html/index.php line 36
    OC::handleRequest()

POST /settings/admin/mailtest
from MyWAN-IP by MyUserName at 2023-11-29T10:14:47+00:00

What mailbox is not available?
Can somebody give me some advise?
Thanks

https://support.google.com/a/answer/3221692?hl=en

550 Requested command failed because the userā€™s mailbox was unavailable, or the receiving server rejected the message because it was likely spam

Did you enter a valid Email Address for you Admin user under ā€œPersonal Settingsā€ ā†’ ā€œEmailā€?

1 Like

I checked Personal Settings. In there I used the yahoo email address.
In the Basic Settings Email Server settings I used the gmail address.
This happened because I tested with 2 mail addresses. After changing to gmail and recreation of a new app password everything works now. Thanks for your help.

2 Likes

I still cannot get this working even after I added this to config.php

"mail_smtpstreamoptions" => array(
    'ssl' => array(
        'allow_self_signed' => true,
        'verify_peer' => false,
        'verify_peer_name' => false
    )
),

bumpā€¦ still not working for me.

Ofcourse yes - your Nextcloud mail is the client.

You may want to open your own topic with your server details, log output ect. so there is more detail to go on than that one screenshot. You appear to be having a separate issue now that OP has marked this solved.