Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Email Styling and Redirection Issues in Gmail #9564

Closed
1 of 3 tasks
VictorHachard opened this issue May 17, 2024 · 5 comments · Fixed by #12831
Closed
1 of 3 tasks

Email Styling and Redirection Issues in Gmail #9564

VictorHachard opened this issue May 17, 2024 · 5 comments · Fixed by #12831

Comments

@VictorHachard
Copy link

The bug

I have configured a mail server with Google. However, I have two issues:

  • When I receive the email, the styling is not like the screen is the release note.
  • When clicking on the button, the redirection URL is incorrect, leading to a 404 error.

image
image

I see in the code that the base URL is concatenated with /auth/#. In my case, the base URL https://xxx/ combined with /auth/# results in the double slashes (https://xxx//auth/#).

image

Also, I am using Nginx with Nginx Proxy Manager. Could this be causing the ending / in my base URL?

The OS that Immich Server is running on

TrueNAS-SCALE-23.10.2

Version of Immich Server

v1.105.1

Version of Immich Mobile App

v1.105.1

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

Running on TrueNAS

Your .env content

Running on TrueNAS

Reproduction steps

1. Configure the mail server with Google in the Immich application.
2. Create a user and send the email.
3. Open the email in Gmail.
4. Observe the incomplete styling of the email.
5. Click on the button within the email.
6. Notice the incorrect redirection URL: https://xxx//auth/# which results in a 404 error due to the double slashes.

Relevant log output

No response

Additional information

No response

@alextran1502
Copy link
Contributor

Thanks, the double / is the issue

@Snowknight26
Copy link
Contributor

Probably something as easy as changing the following code block:

const { server } = await this.configCore.getConfig();
const { html, text } = this.notificationRepository.renderEmail({
template: EmailTemplate.WELCOME,
data: {
baseUrl: server.externalDomain || 'http://localhost:2283',
displayName: user.name,
username: user.email,
password: tempPassword,
},
});

    const { server } = await this.configCore.getConfig();
    const baseUrl = () => {
      let url = 'http://localhost:2283';
      try {
        var url = (new URL(server.externalDomain)).origin;
      } catch (e) {}
      return url;
    }
    const { html, text } = this.notificationRepository.renderEmail({
      template: EmailTemplate.WELCOME,
      data: {
        baseUrl: url,
        displayName: user.name,
        username: user.email,
        password: tempPassword,
      },
    });

(if you don't care about IE you can remove the (e) part).

Ideally this should be earlier on, especially if server.externalDomain is used elsewhere, but this should work.

@jrasm91
Copy link
Contributor

jrasm91 commented May 17, 2024

Let's instead normalize it in getConfig instead.

@VictorHachard
Copy link
Author

For the styling issue, I transferred my email to Outlook, and there is no problem. It seems to be an issue with Gmail.

image

@VictorHachard
Copy link
Author

INFO: not fixed in v1.107.2

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants