cachethq / Docker

A Dockerized version of Cachet.
https://cachethq.io
BSD 3-Clause "New" or "Revised" License
415 stars 280 forks source link

Mail subscriptions don't work #232

Closed nalipaz closed 3 years ago

nalipaz commented 6 years ago

I have attempted most everything to get email subscriptions working in the Docker image. I am able to sign-up for subscriptions however I don't receive the verification email or any of the notification emails. Is there anything wrong in my docker-compose?

version: "3"

services:
  postgres:
    image: postgres:9.5
    volumes:
      - /var/lib/postgresql/data
    environment:
      - POSTGRES_USER=[redacted]
      - POSTGRES_PASSWORD=[redacted]
    restart: always
  cachet:
    build:
      context: .
      args:
        - cachet_ver=v2.3.12
    ports:
      - 8000:8000
    links:
      - postgres:postgres
    environment:
      - DB_DRIVER=pgsql
      - DB_HOST=postgres
      - DB_PORT=5432
      - DB_DATABASE=postgres
      - DB_USERNAME=[redacted]
      - DB_PASSWORD=[redacted]
      - APP_KEY=base64:[redacted]
      - DEBUG=true
      - MAIL_DRIVER=sendmail
      - MAIL_NAME=My\sName
      - MAIL_ADDRESS=me@example.com
      - MAIL_USERNAME=me@example.com
      - QUEUE_DRIVER=database
    depends_on:
      - postgres
    restart: always

I receive the following errors when I add a subscriber:

cachet_1    | [2017-09-19 16:41:52] Failed: mailer@handleQueuedMessage
cachet_1    | 2017-09-19 16:41:52,243 CRIT uncaptured python exception, closing channel <POutputDispatcher at 140055294849680 for <Subprocess at 140055296069216 with name queue-worker in state RUNNING> (stdout)> (<type 'exceptions.IOError'>:[Errno 29] Invalid seek [/usr/lib/python2.7/site-packages/supervisor/supervisord.py|runforever|235] [/usr/lib/python2.7/site-packages/supervisor/dispatchers.py|handle_read_event|232] [/usr/lib/python2.7/site-packages/supervisor/dispatchers.py|record_output|166] [/usr/lib/python2.7/site-packages/supervisor/dispatchers.py|_log|142] [/usr/lib/python2.7/site-packages/supervisor/loggers.py|info|275] [/usr/lib/python2.7/site-packages/supervisor/loggers.py|log|293] [/usr/lib/python2.7/site-packages/supervisor/loggers.py|emit|186] [/usr/lib/python2.7/site-packages/supervisor/loggers.py|doRollover|211])
djdefi commented 6 years ago

I dont think sendmail works currently. Sort of complicated to get into the container with all of the right options. The mailgun or sns drivers are all that I have tested with.

chadhutchins182 commented 6 years ago

Is there a list of supported mail drivers for Cachet Docker? I'm trying to use smtpwith Amazon's Simple Email Service and it doesn't appear to be working. But I'm also having trouble narrowing down the problem.

paustin01 commented 6 years ago

Anyone get this working in Docker? I can subscribe, but my gmail account never receives the email. Tried manual smtp commands from within the container using telnet, targeting the same host/port that I'm using in my config and I verified I can receive that email. Is there logging or a way to debug mail in cachet? Note I'm NOT seeing the python exception that @nalipaz mentioned and I'm running APP_DEBUG="true" as you can see in my (redacted) /var/www/html/.env file below.

I'm running docker image: cachethq/docker:2.3.13

APP_ENV="development"
APP_DEBUG="true"
APP_URL="http://localhost"
APP_LOG="errorlog"
APP_KEY="base64:[REDACTED]"

DB_DRIVER="pgsql"
DB_HOST="[REDACTED]"
DB_DATABASE="postgres"
DB_USERNAME="[REDACTED]"
DB_PASSWORD="[REDACTED]"
DB_PORT="5432"
DB_PREFIX=""

DOCKER=true

CACHE_DRIVER="apc"

SESSION_DRIVER="cookie"
SESSION_DOMAIN="{{SESSION_DOMAIN:-$APP_URL}}"
SESSION_SECURE_COOKIE="false"

QUEUE_DRIVER="database"

CACHET_EMOJI="false"
CACHET_BEACON="true"
CACHET_AUTO_TWITTER="true"

MAIL_DRIVER="smtp"
MAIL_HOST="[REDACTED]"
MAIL_PORT="25"
MAIL_USERNAME="null"
MAIL_PASSWORD="null"
MAIL_ADDRESS="status@[REDACTED].com"
MAIL_NAME="Status"
MAIL_ENCRYPTION="null"

REDIS_HOST="null"
REDIS_DATABASE="null"
REDIS_PORT="null"
REDIS_PASSWORD="null"

GITHUB_TOKEN="null"

NEXMO_KEY="null"
NEXMO_SECRET="null"
NEXMO_SMS_FROM="Cachet"
paustin01 commented 6 years ago

Ok update. Strangely without changing anything config-wise, I tried manually adding a subscriber on the subscribers tab in the dashboard and I got that confirmation email. I deleted it and then tried again from the front end by clicking the Subscribe button and it magically started working. Maybe an intermittent issue? I'll report back if it happens again.

0xjjpa commented 5 years ago

Just wanted to add the setup that worked for me using Docker and Mailgun. Please bear in mind that unless you are verified by Mailgun and your MX records are propagated, no email will go through.

All the following data are stored in docker-compose.yml and have no quotes.

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=postmaster@mail.website.io
MAIL_PASSWORD=<DEFAULT_PASSWORD_PROVIDED_BY_MAILGUN>
MAIL_ADDRESS=postmaster@mail.website.io
MAIL_NAME=Status
MAIL_ENCRYPTION=null

Currently, the application is on http and we want to migrate it to https but it's able to send emails on http. The MAIL_NAME is one word but might be able to support spaces, we will see if it requires quotes (e.g. Status Report Page) or escaped spaces (e.g. Status\sReport\sPage). Finally, whether instead of using the default password by Mailgun we can replace it by an API_KEY.

To test this setup I tried to invite myself to the ”Team” section of the application, and within 30 secs the email arrived with the log Processed: mailer@handleQueuedMessage showing in the console. I'll continue a couple tests and document them within this thread.

tomck commented 4 years ago

For me (necroposting in a very important thread), I get an error 500 whenever I try to even send a test e-mail. I tried the method @jjperezaguinaga posted above, albeit with Office365, and no success. I even have the log-to-terminal up and I don't even get a python error, just an error 500 on POST.