Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Email Sending Problem using external smtp #707

Closed
hack3r-0m opened this issue Oct 26, 2020 · 2 comments
Closed

Email Sending Problem using external smtp #707

hack3r-0m opened this issue Oct 26, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@hack3r-0m
Copy link
Contributor

hack3r-0m commented Oct 26, 2020

🐛 Bug Report

Due to some variables missing in .env, the mail-worker is not able to send mails

Have you spent some time to check if this issue has been raised before?

Yes

To Reproduce

  • clone 0.7.x
  • edit Dockerfile to add your SMTP credentials (SendGrid in my case)
  • compose
  • make a project and create a new user
  • hit verification endpoint to send a mail to users' mail address to get verified

Expected behavior

Sendgrid SMTP credentials were correct, mail limit was not reached, _APP_SYSTEM_EMAIL_ADDRESS was in allowed senders, so mail was supposed to reach users' inbox.

Output of docker-compose exec appwrite vars:

- _APP_ENV=development
- _APP_OPTIONS_ABUSE=disabled
- _APP_OPTIONS_FORCE_HTTPS=disabled
- _APP_OPENSSL_KEY_V1=your-secret-key
- _APP_DOMAIN=demo.appwrite.io
- _APP_DOMAIN_TARGET=demo.appwrite.io
- _APP_REDIS_HOST=redis
- _APP_REDIS_PORT=6379
- _APP_DB_HOST=mariadb
- _APP_DB_PORT=3306
- _APP_DB_SCHEMA=appwrite
- _APP_DB_USER=user
- _APP_DB_PASS=password
- _APP_INFLUXDB_HOST=influxdb
- _APP_INFLUXDB_PORT=8086
- _APP_STATSD_HOST=telegraf
- _APP_STATSD_PORT=8125
- _APP_SMTP_HOST=smtp.sendgrid.net
- _APP_SMTP_PORT=587
- _APP_STORAGE_LIMIT=100000000
- _APP_FUNCTIONS_TIMEOUT=900
- _APP_FUNCTIONS_CONTAINERS=10

Dockerfile Edits :

    _APP_SMTP_HOST=smtp.sendgrid.net \
    _APP_SMTP_PORT=587 \
    _APP_FUNCTIONS_TIMEOUT=900 \
    _APP_FUNCTIONS_CONTAINERS=10 \
    _APP_SETUP=self-hosted \
    _APP_VERSION=$VERSION
ENV _APP_SMTP_SECURE=tls
ENV _APP_SMTP_USERNAME=apikey
ENV _APP_SMTP_PASSWORD=<MY_API_KEY>

Actual Behavior

docker-compose logs appwrite-worker-mails shows that mail was rejected by sendgrid with error code 550 (Unauthenticated Sender)

[critical] (Job{v1-mails} | ID: 0e4a610fef92a3ff620b93cbae006e47 | MailsV1 | [{"event":"account.verification.create","from":"testProject Team","recipient":"X@gmail.com","name":"","subject":"Account Verification","body":"<!doctype HTML>...
,550, SMTP server error: MAIL FROM command failed Detail: Unauthenticated senders not allowed

Your Environment

Ubuntu 20.04

Workaround

As some vars were missing in docker-compose exec appwrite vars (shown above), as per @eldadfux suggestion, I manually added in docker-compose.yml as follow:

appwrite-worker-mails:
    entrypoint: worker-mails
    container_name: appwrite-worker-mails
    build:
      context: .
    restart: unless-stopped
    networks:
      - appwrite
    depends_on:
      - redis
      - maildev
      # - smtp
    environment:
      - _APP_SYSTEM_EMAIL_NAME=self
      - _APP_SYSTEM_EMAIL_ADDRESS=<MY_EMAIL>
      - _APP_REDIS_HOST=redis
      - _APP_REDIS_PORT=6379
      - _APP_SMTP_HOST=smtp.sendgrid.net
      - _APP_SMTP_PORT=587
      - _APP_SMTP_SECURE=tls
      - _APP_SMTP_USERNAME=apikey
      - _APP_SMTP_PASSWORD=<MY_API_KEY>

composed again and hit verification endpoint and I was able to receive mail successfully.

@hack3r-0m hack3r-0m added the bug Something isn't working label Oct 26, 2020
eldadfux added a commit that referenced this issue Oct 26, 2020
@eldadfux eldadfux added the waiting for release Fixed or implemented and waiting for a new version to be released label Oct 26, 2020
@eldadfux
Copy link
Member

eldadfux commented Nov 3, 2020

This issue has been fixed and will be released on next version (0.7.x). Currently this solution is available on branch 0.7.x

@eldadfux
Copy link
Member

v0.7 is finally out with the fix available 🥳

@eldadfux eldadfux removed the waiting for release Fixed or implemented and waiting for a new version to be released label Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants