W
Wasp-lang•2mo ago
bmsanoussy

Integration Issue with Mailgun in Wasp: 'Forbidden' Error Related to EU Domain

Hello, I'm using Wasp, and I want to send emails using the Mailgun provider, but I'm encountering an issue with a "forbidden" error. After some research, I found that the problem is related to the base URL. For domains created in the EU region, you need to add .eu to the URL, like this: https://api.eu.mailgun.net/. Here's the documentation: https://documentation.mailgun.com/docs/mailgun/user-manual/get-started. Is it possible to fix this issue? I can't find where in the Wasp project the URL is configured to apply this fix while waiting for an official solution. Thank you.
10 Replies
kapa.ai
kapa.ai•2mo ago
Hi @bmsanoussy. 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, but the provided knowledge sources do not contain information on how to configure the base URL for the Mailgun provider in a Wasp project. It would be best to refer to the official Wasp documentation or their support channels for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @bmsanoussy, 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?
bmsanoussy
bmsanoussy•2mo ago
It's possible to specify the host in the ts-mailgun instance. We could add a new property MAILGUN_ZONE, with a default value of US. If this property is set to EU, the host would be added to the instance options. Something like this.
export function initMailgunEmailSender(
config: MailgunEmailProvider
): EmailSender {
const mailer = new NodeMailgun(config.apiKey, config.domain);

// Setting Mailgun options
if(config.zone === 'EU') {
mailer.options = {
host: 'api.eu.mailgun.net'
};
}
...
}
export function initMailgunEmailSender(
config: MailgunEmailProvider
): EmailSender {
const mailer = new NodeMailgun(config.apiKey, config.domain);

// Setting Mailgun options
if(config.zone === 'EU') {
mailer.options = {
host: 'api.eu.mailgun.net'
};
}
...
}
martinsos
martinsos•2mo ago
Sounds like good direction @bmsanoussy , but I will let @miho take a closer look!
bmsanoussy
bmsanoussy•2mo ago
Thanks @martinsos you and all the team are doing a good job
miho
miho•2mo ago
This is related to https://github.com/wasp-lang/wasp/issues/1553 We need to expose the underlying email sender mechanism to the users to they can do custom configuration as needed. For this specific case it would probably work by us exposing the mailer to you and you could configure it as needed.
GitHub
[Email sender] Allow specifying provider specific options, like tem...
Right now, when defining an email sender, and when sending an email via it, we don't allow any provider-specific options. It would be useful to provide some, because for example, users using Se...
Mrr
Mrr•2w ago
@bmsanoussy is the issue solved??
miho
miho•2w ago
Nope, we didn't yet tackle this issue, sorry! We'll bump the priority on this
Mrr
Mrr•6d ago
@miho ohh please let us know when this issue gets fixed. Thanks!! Is there any other way which works instead of mailgun?? I want to use EU Domain for mailing Can this be a temporary solution?? So I am not using wasp email service instead I'm using the api endpoint given by mailgun which has EU. And I'm hitting this endpoint. And it's working fine for me. Will I get into any error during long term is my question??
martinsos
martinsos•5d ago
That is all right, you can use mailgun directly! However, it won't be used in the email and password authentication method to send emails, if you are using it, so that would be an issue. If not, it doesn't matter. Btw, workaround might be to use Mailgun as Wasp Mail Sender, but via SMTP option?
miho
miho•4d ago
Btw, workaround might be to use Mailgun as Wasp Mail Sender, but via SMTP option?
That is true! Have you maybe tried that? 🙂
Want results from more Discord servers?
Add your server