Mails not being sent (Mailgun and Sendgrid tested => both haven't even got an API request)

Hey, I have setup my main.wasp with my email I have registered and set the APIKey - for password reset I am getting 200 as return but no mail is ever being sent
K
kapa.ai14d ago
Hi @Johnny. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry to hear that you're having trouble with sending emails. Here are a few things you can check: 1. Provider Setup: Make sure you have correctly set up the email provider in your main.wasp file. If you're using Mailgun, your setup should look like this:
app Example {
...
emailSender: {
provider: Mailgun,
}
}
app Example {
...
emailSender: {
provider: Mailgun,
}
}
If you're using SendGrid, replace Mailgun with SendGrid in the provider field. 2. API Key and Domain: Ensure that you have correctly added your Mailgun API key and domain to your .env.server file. The file should look like this:
MAILGUN_API_KEY=your_api_key
MAILGUN_DOMAIN=your_domain
MAILGUN_API_KEY=your_api_key
MAILGUN_DOMAIN=your_domain
If you're using SendGrid, replace MAILGUN_API_KEY and MAILGUN_DOMAIN with your SendGrid API key and domain. 3. Email Address: Check if you have already logged in with the same email address using the Email method. If so, run wasp db studio and delete that user and try logging in again. 4. Check Logs: If you're using the Dummy provider during development, it will console.log the emails in the console instead of sending them. Check your console logs to see if the emails are being logged. 5. Check with Provider: If everything seems to be set up correctly, but emails are still not being sent, it might be worth checking with your email provider (Mailgun or SendGrid) to see if they have received any API requests. If you're still having trouble, it might be helpful to look at the Wasp documentation on sending emails (https://wasp-lang.dev/docs/advanced/email) or ask for help in the Wasp Discord community (https://discord.com/channels/686873244791210014/1179895919471247490). Sources: - Wasp Documentation: Sending Emails (https://wasp-lang.dev/docs/advanced/email) - Wasp Documentation: Using the Mailgun Provider (https://wasp-lang.dev/docs/advanced/email#using-the-mailgun-provider) - Wasp Discord Community (https://discord.com/channels/686873244791210014/1179895919471247490) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Johnny, 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?
J
Johnny14d ago
Edit - found the issue - some error handling would maybe an idea If the use has no email in the database he cant get a mail delivered Edit 2: still getting no emails delivered
M
MEE614d ago
Wohooo @Johnny, you just became a Waspeteer level 1!
M
miho14d ago
We need more information to be able to help you 🤷🏻‍♂️ what kind of app are you building? Are you using open saas? Did you use Mailgun or Sendgrid before successfully? Sometimes you need to verify the sending domain and it might work only for your test email acc. That's want happened to me sometimes.
J
Johnny14d ago
I switched from sendgrid/mailgun to a smtp server (hetzner) I am using open saas And trying to figure out how to get the mail sencind done Manages to use it succesfully with my own application already
M
miho14d ago
Could you share a bit of code? 🫡
J
Johnny14d ago
set up SMTP_HOST=mail.your-server.de SMTP_USERNAME=info@xx.com SMTP_PASSWORD= SMTP_PORT=465 Could it be that password reset is not set up by default?
auth: {
// 1. Specify the user entity (we'll define it next)
userEntity: User,
methods: {
// 2. Enable email authentication
email: {
// 3. Specify the email from field
fromField: {
name: "xx",
email: "info@xx.com"
},
// 4. Specify the email verification and password reset options (we'll talk about them later)
emailVerification: {
clientRoute: EmailVerificationRoute,
getEmailContentFn: import { getVerificationEmailContent } from "@src/server/auth/email.ts",

},
passwordReset: {
clientRoute: PasswordResetRoute,
getEmailContentFn: import { getPasswordResetEmailContent } from "@src/server/auth/email.ts",
},
},

auth: {
// 1. Specify the user entity (we'll define it next)
userEntity: User,
methods: {
// 2. Enable email authentication
email: {
// 3. Specify the email from field
fromField: {
name: "xx",
email: "info@xx.com"
},
// 4. Specify the email verification and password reset options (we'll talk about them later)
emailVerification: {
clientRoute: EmailVerificationRoute,
getEmailContentFn: import { getVerificationEmailContent } from "@src/server/auth/email.ts",

},
passwordReset: {
clientRoute: PasswordResetRoute,
getEmailContentFn: import { getPasswordResetEmailContent } from "@src/server/auth/email.ts",
},
},

db: {
system: PostgreSQL,
seeds: [
import { devSeedUsers } from "@src/server/scripts/usersSeed.js",
]
},
client: {
rootComponent: import App from "@src/client/App",
},
emailSender: {
provider: SMTP,
},
}
db: {
system: PostgreSQL,
seeds: [
import { devSeedUsers } from "@src/server/scripts/usersSeed.js",
]
},
client: {
rootComponent: import App from "@src/client/App",
},
emailSender: {
provider: SMTP,
},
}
I have no clue what I am doing wrong tbh. 😄 And with "Dummy" I am only getting
[ Server ] GET /auth/me 401 0.520 ms - 43
[ Server ] POST /auth/email/request-password-reset 200 1856.935 ms - 16
[ Server ] GET /auth/me 401 0.656 ms - 43
[ Server ] GET /auth/me 401 0.520 ms - 43
[ Server ] POST /auth/email/request-password-reset 200 1856.935 ms - 16
[ Server ] GET /auth/me 401 0.656 ms - 43
And
import { type GetVerificationEmailContentFn, type GetPasswordResetEmailContentFn } from "wasp/server/auth";

export const getVerificationEmailContent: GetVerificationEmailContentFn = ({ verificationLink }) => ({
subject: 'Verify your email',
text: `Click the link below to verify your email: ${verificationLink}`,
html: `
<p>Click the link below to verify your email</p>
<a href="${verificationLink}">Verify email</a>
`,
});

export const getPasswordResetEmailContent: GetPasswordResetEmailContentFn = ({ passwordResetLink }) => ({
subject: 'Password reset',
text: `Click the link below to reset your password: ${passwordResetLink}`,
html: `
<p>Click the link below to reset your password</p>
<a href="${passwordResetLink}">Reset password</a>
`,
});
import { type GetVerificationEmailContentFn, type GetPasswordResetEmailContentFn } from "wasp/server/auth";

export const getVerificationEmailContent: GetVerificationEmailContentFn = ({ verificationLink }) => ({
subject: 'Verify your email',
text: `Click the link below to verify your email: ${verificationLink}`,
html: `
<p>Click the link below to verify your email</p>
<a href="${verificationLink}">Verify email</a>
`,
});

export const getPasswordResetEmailContent: GetPasswordResetEmailContentFn = ({ passwordResetLink }) => ({
subject: 'Password reset',
text: `Click the link below to reset your password: ${passwordResetLink}`,
html: `
<p>Click the link below to reset your password</p>
<a href="${passwordResetLink}">Reset password</a>
`,
});
Anyone an idea why SMTP isn't working? Password, username etc. is correct For anyone having simillar problems - solved it. It seems to only work with port 587 via hetzner (465 isn't)
Want results from more Discord servers?
Add your server
More Posts
uiWhich ui component library works well with waspRunning the backend as a regular node.js app?Hi, I'm wondering if it's possible to run the backend as a regular node.js application like 'npm staWhere to startIm a UI designer dabbling in trying to create my first app w/ GitHub code pilot as I’m not a developrunning wasp inside google idx errorI am trying to setup the dev environment test out opensaas with google online ide idx, but when I trApp crashed for unknowing reasonHey, I start the app when it's still v-0.12.0, it works fine till today, nothing changed on my end btrying to run wasp.sh server on dockerHey guys, so I tried dockerising wasp-sh after I saw it on your recent reddit post. 1. I created aConfused about [Client ]HMR[Wasp 0.13.0, MacOs] Hey guys, I am trying to update wasp header/nav bar to a new style with framerIssue with deploying my wasp app to fly.ioI'm trying to deploy my wasp app to fly.io, but I'm encountering an error that doesn't make sense. Whas anyone got shadcn to work with wasp? I am trying but keep getting an errorAttached is the error I am currently getting. Just wondering if anyone has had success with it?"wasp start db" takes too much time.Any solution for this? i seem to be stuck in a loop and i can't do "Wasp start" until this resolves.Best Practices for Implementing Auth System in Chrome Extension Connected to OpenSaaSHello, everyone! I'm currently developing a SaaS product and have created a Chrome extension. I'm aCompile / Parse error with the ToDoApHello all , I just downloaded and installed Wasp on Windows 11 with WSL2. The installation wenPossibility to disable wasp reload on UI file changes?Hey my dudes, is it possible to calm down this guy on the screenshot from reloading everything everyWhat's the best way to start with Wasp?I'm looking for the best way to start with learning Wasp.onAuthSucceededRedirectTo previous siteWhen I open a Link in my app where Auth is required but my session expired, I get redirected to the Is there something missing? :(I'm following this guide. https://wasp-lang.dev/blog/2023/11/21/guide-windows-development-wasp-wsl Bdynamic variables in main.waspIs it currently possible to dynamically change configuration values in main.wasp? E.g for developmGoogle Auth in ProdI made my first try with the wasp deployment. So far its pretty straightforward, directly deploy to How can I get current theme colors and set them to div ?I want to set background of a div according to the current selected theme. if dark theme is selecteCalling queries without useQuery hookHi, I'm trying to call a query directly, from the client, without using the hook, but couldn't figur