subdomain: joljug5uooke
admin interface says, it could not compile my code correctly. I didn’t see that error before. It must be that the cloud code is not valid. Strange it worked before
Can you check my cloud.js file and tell me if you see anything wrong? I literally took the cloud code as was from the legacy version of my cloud functions.
Try to remove this line
EDIT: Ok! now we are on! somehow it started working Not sure, the import might have fixed it. When I try to log the request of my cloud function it gives me undefined in the realtime console logger. How come? How can I pass on data when calling
Moralis.Cloud.run("myMailFunc")
I tried
Moralis.Cloud.run("myMailFunc", {params: message })
But request object of the cloudfunction is undefined
Ok, I got the functions working now. The logs confirm that the function got executed and I can now also debug. Haven’t managed yet to receive an e-mail though… Will keep you posted. Thanks for the support @cryptokid
Did you set your sendgrid api key in admin interface?
Yes, Sendgrid API Key is set. I get Result: Undefined
in the logs when executing the sendMail function. Any clues?
Here is my cloud mail function:
Moralis.Cloud.define("sendEmailToAdmin", (request) => {
const logger = Moralis.Cloud.getLogger();
logger.info(request.params);
Moralis.Cloud.sendEmail({
to: "[email protected]",
subject: request.params.title,
html: `From: ${request.params.from}, Message: ${request.params.message}`
});
});
You have to return something to get something different than undefined
You can also try to use try catch
Here you have to use JSON.stringify
as in logger.info(JSON.stringify(request.params));
Cheez of course, thank you. Still not getting mail though. I also do not see any request in the SendGrid Dashboard.
it looks like this worked in the past
try a simpler text for that email, also try to look in spam folder
did you try to use try catch?
Interesting. SendGrid was able to verify my implementation. Their integration setup guide even said that they received my email. still, i do not see any mails in the inbox. oh and yes, using try catch, never catched anything yet.
try to look in the spam folder, sometimes the emails get there
nope, not there. Hm… at the moment I am out of clues.
try to send an email to a different email
Yes, I did try that. not working either. Tried several emails already
did you try a simple example like:
Moralis.Cloud.sendEmail({
to: "**@***********.com",
subject: "Test",
html: "Test"
});
?
nothing else in html or subject
yes, did try the simple example.
from the sendgrid website:
“Our library requires Node.js version 0.10, 0.12, or 4.”
Which one does moralis server use?
Update: I found that sendgrid is still processing every single testmail i sent in the past couple of hours. Quite a few… So I assume that Moralis.Cloud.sendMail is working correctly. Thank you for patience @cryptokid
For future readers: It seems that several mail providers, f.e. yahoo, gmail and web-hosting.com, are somehow blocking SendGrid. Does anyone have similiar issues? This is really annoying. Mails get forwarded to sendgrid by Moralis, but their they are stuck forever and will not get delivered…