getmeli / meli

Platform for deploying static sites and frontend applications easily. Automatic SSL, deploy previews, reverse proxy, and more.
Other
2.4k stars 97 forks source link

No invitation mail is sent. #223

Closed damyo closed 3 years ago

damyo commented 3 years ago
    environment:
    # no trailing slash !
    MELI_URL: https://project.mydomain.com
    MELI_MONGO_URI: mongodb://mongo:27017/meli
    # openssl rand -hex 32
    MELI_JWT_SECRET: XXX
    # https://docs.meli.sh/authentication
    MELI_USER: meli_user
    MELI_PASSWORD: meli_password
    MELI_MAX_ORGS: 0
    MELI_MAIL_FROM: mail_adress
    MELI_MAIL_HOST: localhost
    MELI_MAIL_PORT: 1025
    MELI_MAIL_USERNAME: mail_account_username
    MELI_MAIL_PASSWORD: mail_account_password

As a test, I invited using my email address, but the email did not come. So, I added mail related settings to docker-compose.yml as above. But I got a 500 error, I modified the host to 0.0.0.0 but it was the same(I'm using AWS). When I deleted the host part, there was no 500 error, but there was still no mail. At first I used noreply@meli.sh as an example, but it didn't work, so I entered my real email address(G-mail), and I also entered my username and password with real account information. I have tried various things, but all of them are to no avail. I tried adding the mailhog container to docker-compose.yml as well, but it failed, and since meli is using it on its own, I understand that I don't need to add it, so I removed mailhog again. Is there anything I am missing?

gempain commented 3 years ago

Hi there ! So there are a few things to know about email, Meli and Docker. By default, Meli doesn't have any email configuration and prints emails to the console, that's why you're not receiving anything. Meli doesn't embed Mailhog either. If you want to use MailHog, you'll have to have the container on the side. I just noticed there was a mistake in the docs. Using localhost as MELI_MAIL_HOST will not work as this points to the Docker container itself. It should be mailhog instead. So, the proper config would be:

docker-compose.yml:

version: "3"
services:
  meli:
    # ...
    environment:
      # ...
      MELI_MAIL_FROM: noreply@meli.sh
      MELI_MAIL_HOST: mailhog
      MELI_MAIL_PORT: 1025
  mailhog:
    image: mailhog/mailhog
    ports:
      - 127.0.0.1:8025:8025
      - 127.0.0.1:1025:1025

I'm not sure why your GMail email address is not working though. There might be configuration issues with SSL and nodemailer. I'll experiment and keep you posted. In the meantime, you can use MailHog.

damyo commented 3 years ago
version: "3"
services:
  meli:
    # ...
    environment:
      # ...
      MELI_MAIL_FROM: user@gmail
      MELI_MAIL_HOST: smtp.gmail.com
      MELI_MAIL_PORT: 587
      MELI_MAIL_USERNAME: user@gmail
      MELI_MAIL_PASSWORD: password@gmail
  mailhog:
    image: mailhog/mailhog
    ports:
      - 1025:1025
      - 8025:8025

@gempain E-mail reception was successful with the above settings. However, when I opened the address in the email, I was redirected to the signin page, but I couldn't sign up. Strangely, only when I open this link while logged in to meli as an administrator, it leads to a page with a DECLINE button and a ACCEPT button. However, even in this case, if you click the ACCEPT button, an error 500 occurs, and if you refresh, the message Error: Request failed with status code 404 appears.

damyo commented 3 years ago

I just checked this article. https://github.com/getmeli/meli/issues/177 I'll try again.

gempain commented 3 years ago

@damyo glad Gmail worked ! Yes, sorry for the strange onboarding process. It's something we need to improve, but I'm glad you found #177 which details this a bit more. As your original issue is solved (emails), I'll close this, but you're welcome to open a new issue if you need help with something else. If you still have issues with emails, we can reopen.

Regarding the 500, I think it's because you're trying to accept an invite for an organization you're already in. It's an edge case we should fix. You then get the 404 because you've accepted the invite and the backend can't find that invite anymore. We'll try to improve this. I'll log it in another issue.