Issues with MailGun
I'm attempting to add MailGun as my email provider, but running into some issues - whenever I attempt to use mailgun, I get a dependency error from ts-mailgun:
I investigated this and whilst there's little info online, I did find this on stackoverflow which says that version 0.5 (the version of wasp) has the issue, and 0.18 fixes it - https://stackoverflow.com/questions/50906419/cannot-read-property-validate-of-undefined-in-mailgun-js
I am using wasp v0.13.2
Stack Overflow
Cannot read property 'validate' of undefined in mailgun-js
I am using mailgun-js to validate emails. I'm implementing the same way as described in the documentation mailgun-js documentation.
my code :
var domain = 'postmaster.xxxx.in';
var api_key = 'pub...
22 Replies
Hi @CamBlackwood. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. The knowledge sources provided do not contain information about the specific error you're encountering with ts-mailgun and Wasp.
However, I can guide you on how to set up Mailgun as your email provider in Wasp. You need to set the provider to
Mailgun
in the main.wasp
file and then get the Mailgun API key and domain and add them to your .env.server
file. Here is how you can do it:
In your main.wasp
file:
In your .env.server
file:
You can get the API key and domain by creating an account on Mailgun, creating a new API key and domain, and then adding them to your .env.server
file.
For more detailed instructions, you can refer to the Wasp documentation (https://wasp-lang.dev/docs/advanced/email#using-the-mailgun-provider).
For the specific error you're encountering, I would recommend reaching out to the Wasp community on Discord (https://discord.gg/rzdnErX) or via email at [email protected] for more assistance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @CamBlackwood, 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?Sorry, I should also add that as far as I can tell my env file is correct. (api key and domain), happy to DM these to a wasp team member though to verify
Let me check what is going on 😊
Hi! I'm facing the same issue as @CamBlackwood Any updates in this regard? Thanks in advance! @kapa.ai
Let me check the knowledge base for you. One moment! :books:
----------------------
I'm sorry, but the knowledge sources provided do not contain any information about an issue reported by a user with the ID
772532264775975003
. Therefore, I'm unable to provide any updates or solutions in this regard.
For specific issues, I recommend reaching out to the Wasp community on Discord (https://discord.gg/rzdnErX) or via email at [email protected] for more assistance. They might be able to provide more context and potential solutions.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Janus, 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?Sorry for dropping the ball on this, I still haven't tested this out 😢 @CamBlackwood did you manage to resolve this one?
Still broken for me unfortunately
So, I've tested it out like this with Wasp 0.13.2:
and env vars:
And it worked for me 😄
@CamBlackwood was this similar to your setup or @Janus your setup?
Will confirm in the next 30 mins 🙂
Thank you 👍 let me know how it goes
Thanks for your support and help @miho 🙂 But I’m still having the same issue. I adapted your setup for my contact form where I want to use emailSender, but I'm still getting the same error that @CamBlackwood mentioned.
It's weird because Mailgun integration works perfectly for user registration verification 🤔 Any ideas on what might be wrong?
Thanks again! 🙏
can confirm I've got the exact same issue as well. Are you using open saas @Janus ? Wonder if that could be the issue
Oh yeah, you are using
wasp/server/email
imports in the client code? That is not possible 😄
One more for the detecting server imports on the client issue. https://github.com/wasp-lang/wasp/issues/2067 @martinsos
You need to create an action
which uses the emailSender
and then you need to invoke the action from the client 🙂GitHub
Detect server imports on the client · Issue #2067 · wasp-lang/wasp
Users sometimes import server specific code from wasp/server/* on the client and it's hard to debug. It's not obvious to new users that this is not something they shouldn't do since the...
ah interesting, that makes sense now that you spell it out. I'll give that a crack and let you know how it goes. Thanks!
@miho in situations like this I just pop a comment in that GitHub issue with link to Discord, to accumulate information + emphasize how much of an issue it is. Did it now for you!
Thank you very much for the explanation! It finally worked perfectly for me 🙂
did you get it to work?
And what did you put in the from mail when you send actually an email to yourself
This issue was that I was trying to invoke server code on the client 🙂 was an easy fix one i sorted that
Ah
But have you made a client form on ur site
Where clients can contact?
ah no, it's an email notifier that is sent to the user for certain actions