Kareadita / Kavita

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
http://www.kavitareader.com
GNU General Public License v3.0
5.89k stars 300 forks source link

Cannot send emails when "Username" email setting is not configured #2708

Closed mikeymakesit closed 6 months ago

mikeymakesit commented 7 months ago

What happened?

I was running kavita along with kavita-email and everything was ok. I upgraded to 7.14.0 and removed kavita-email. After this, sending email does not work.

My Email settings do not include a username or a password (never have in Kavita-email) since my SMTP relay uses only IP restrictions for incoming SMTP from my homelab.

I checked the code and found in Kavita/API/DTOs/Settings/ServerSetttingsDTO.cs:

  public bool IsEmailSetup()
    {
        return !string.IsNullOrEmpty(SmtpConfig.Host)
               && !string.IsNullOrEmpty(SmtpConfig.UserName)
               && !string.IsNullOrEmpty(HostName);
    }

This code is requiring Username to be configured, I believe in error. kavita-email did not require it, and it's not required by any SMTP standard.

I think this method should be updated to check Host, Port, and Sender Address as confirmation of minimal successful configuration.

What did you expect?

Emails should be sent when using the settings for my SMTP environment. In my scenario I configure Sender Address, Display Name, Hostname, Port, and SSL.

Kavita Version Number - Don't see your version number listed? Then your install is out of date. Please update and see if your issue still persists.

0.7.14 - Stable

What operating system is Kavita being hosted from?

Docker (Other)

If the issue is being seen on Desktop, what OS are you running where you see the issue?

None

If the issue is being seen in the UI, what browsers are you seeing the problem on?

No response

If the issue is being seen on Mobile, what OS are you running where you see the issue?

None

If the issue is being seen on the UI, what browsers are you seeing the problem on?

No response

Relevant log output

I enabled Trace level logs and no relevant messages were logged.  It might be nice for the reason for failure to get logged as a trace event.

The HTTP response content when clicking "Test" in the Email Settings UI is:

{"successful":false,"errorMessage":"You need to fill in more information in settings and ensure your account has a valid email to send a test email","emailAddress":"<email removed for bug>"}


### Additional Notes

Happily running Kavita (and previously kavita-email) in k3s (kubernetes) since November 2022.
majora2007 commented 7 months ago

As discussed in discord, I will update so that Host, HostName and SenderAddress is checked instead.