Skip to content

Instantly share code, notes, and snippets.

@scmanjarrez
Last active December 6, 2023 19:16
Show Gist options
  • Save scmanjarrez/8f8ded964e1aebd57721c2cd364bbab7 to your computer and use it in GitHub Desktop.
Save scmanjarrez/8f8ded964e1aebd57721c2cd364bbab7 to your computer and use it in GitHub Desktop.
Enable Gmail SMTP on Overleaf Community Edition (CE)

I'll leave my workaround to use with gmail for future reference after testing every suggestion here without success:

  • Define SMTP_USER and SMTP_PASS
       SHARELATEX_EMAIL_SMTP_USER=your_email
       SHARELATEX_EMAIL_SMTP_PASS=app_password # requires 2fa enabled
    
  • Connect to sharelatex container (docker exec) and run this command:
    $ cp /overleaf/services/web/app/src/Features/Email/EmailSender.js /var/lib/sharelatex
  • Move the file EmailSender.js in your ${SHARELATEX_DATA_PATH} (defined in config/overleaf.rc) to wherever you want (I recommend toolkit root folder)
  • Add this definition in line 60 of EmailSender.js (right before client = nodemailer.createTransport(smtp))
    smtp.service = "gmail";
  • Edit lib/docker-compose.base.yml to bind the new file. Add this line in the volumes section
    - ../EmailSender.js:/overleaf/services/web/app/src/Features/Email/EmailSender.js:ro
    

    Use the correct relative/absolute path to your EmailSender.js

Run bin/docker-compose down && bin/docker-compose up -d.

@scmanjarrez
Copy link
Author

Yes, I've tried with "forgot password" and it seems to work. I've uncommented SMTP_USER and SMTP_EMAIL, I think the default port is 465 and host smtp.gmail.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment