I am trying to set up sendgrid mail so I can get a successful demo of my site set up where I need to auto email people. Please let me know if I am being silly as I am still learning and haven't been able to find much on this issue
As stated above I may be missing something completely obvious. I expect it to be sending an email to myself for testing purposes
code follows
Email.js
// import sgMail from '@sendgrid/mail'
class Email {
static sender(recipiant){
// using SendGrid's v3 Node.js Library
// https://github.com/sendgrid/sendgrid-nodejs
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
to: recipiant,
from: '[email protected]',
subject: 'Sending with SendGrid is Fun',
text: 'and easy to do anywhere, even with Node.js',
html: 'and easy to do anywhere, even with Node.js',
};
sgMail.send(msg);
}
}
module.exports = Email
index.js
import Email from '../sendgrid/email.js'
handleClick (event) {
Email.sender('[email protected]');
}
<button onClick={this.handleClick}>
send email
</button>
Hello @BestLuke,
We do not support sending emails from the front end of your application and here is the reasoning.
We suggest you trigger the email from the front end, but call a service on the backend that actually sends the email.
With Best Regards,
Elmer
Too bad. How about SPA and webassembly applications? How about progressive web apps, electron apps...