This is the API required for the change Password function in Symfony-Dall-E to function.
I resorted to creating an api because whenever i import nodemailer
in Symfony-Dall-E webpack wouldn't bundle it correctly and it throws 40 errors 😅
Ofc there might be a better or easier solution. I just used this one.
If you have a way to fix the webpack error go for it and please do a pull request or create an issue explaining how i could fix it myself.
Any feedback is appreciated.
first open the directory and run:
npm install
Then, You'll need to create a secrets.json
file and place it in the root directory. Check Nodemailer if you don't know how to use your Gmail account with nodemailer
{
"senderEmail":NODEMAILER_EMAIL,
"senderPassword":NODEMAILER_PASSWORD,
"emailPort": PORT,
"emailHost": "smtp.gmail.com",
"supabaseUrl": "url",
"supabaseKey": "KEY"
}
then just run and keep it running while you use the webapp
node "./sendnodemail.js"
A small example of how to send the post request using Fetch
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"email": RECEPIENT_EMAIL,
"username": RECEPIENT_USERNAME,
"url": "http://localhost:8000/newpass"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("http://localhost:8080/sendEmail", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));