W
Wasp5d ago
XMDim

EMAIL variables SMPT same in production and development but on production it doesn't send email

EMAIL variables SMPT same in production and development but on production it doesn't send email
9 Replies
kapa.ai
kapa.ai5d ago
Hi @XMDim. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- If your SMTP email variables are the same in both development and production, but emails are not being sent in production, here are some things to consider based on the Wasp documentation: 1. SMTP Provider Setup: Ensure your main.wasp file is correctly set up to use the SMTP provider:
app Example {
...
emailSender: {
provider: SMTP,
}
}

app Example {
...
emailSender: {
provider: SMTP,
}
}

And your .env.server file should include:
SMTP_HOST=
SMTP_USERNAME=
SMTP_PASSWORD=
SMTP_PORT=

SMTP_HOST=
SMTP_USERNAME=
SMTP_PASSWORD=
SMTP_PORT=

Make sure these values are correctly set in your production environment as well as in development. In production, environment variables are typically set via your deployment platform, not via a .env.server file. For example, on Fly.io, you would use flyctl secrets set to set these variables. Double-check that the variables are actually present and correct in your production environment, as missing or incorrect values are a common cause of issues Defining Env Vars in Production. 2. Dummy Provider in Development: In development, you might be using the Dummy provider, which only logs emails to the console and does not actually send them. Make sure you are not using the Dummy provider in production, as the build will fail if you try to use it in production Using the Dummy Provider. 3. Production Environment Differences: Some SMTP providers may block connections from certain IPs or require additional configuration (such as whitelisting your production server's IP). Check your SMTP provider's documentation and logs for any clues. 4. Error Logging: Check your production server logs for any errors related to sending emails. Wasp's emailSender.send method returns an object with the status of the sent email, which can help you debug issues Sending Emails. 5. Network Issues: Ensure your production environment can reach the SMTP server (no firewall or network restrictions). If after checking all of the above you are still having issues, the knowledge sources do not provide further troubleshooting steps specific to SMTP in production. You may need to consult your SMTP provider's documentation or support for more detailed diagnostics. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
XMDim
XMDimOP5d ago
I use custom deployment through coolify
kapa.ai
kapa.ai5d ago
Sorry @XMDim, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
XMDim
XMDimOP5d ago
@kapa.ai I use custom deployment through coolify
kapa.ai
kapa.ai5d ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- I'm sorry, but the knowledge sources do not contain specific information about deploying Wasp with Coolify or troubleshooting SMTP email issues specifically in a Coolify deployment. The documentation covers general SMTP setup, environment variable configuration, and provider selection, but does not mention Coolify or provide Coolify-specific guidance. If your SMTP variables are set correctly and emails work in development but not in production on Coolify, please double-check that your production environment variables are correctly configured and accessible to your Wasp app, as this is a common source of issues. Also, ensure you are not using the Dummy provider in production, as it is only for development use Using the Dummy Provider. For further troubleshooting, you may need to consult Coolify's documentation or support, as the Wasp knowledge sources do not provide more detailed information for this deployment scenario. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @XMDim, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Carlos
Carlos5d ago
Mmmm, my first thought is the SMTP_HOST is reachable from your local computer but not from the server I'd try to ssh-in to the server and do ping your-smtp-host.com to see if it resolves
XMDim
XMDimOP5d ago
I found out why ! 465 is blocked by hetzner so I used 587 port. Weird ? Yeah ofc
Carlos
Carlos5d ago
Oh yeah! Most VPS providers will block email-sending ports because they don’t want their machines to be used for spam What is your setup? Maybe we can add a note in the docs so no more people get in this situation
XMDim
XMDimOP4d ago
It’s coolify with GitHub actions Hetzner blocks 465 (tried with Zoho and gmail as smtp). Hetzner instance 2 cpu 4gb ram with eu region (Helsinki )

Did you find this page helpful?