DEV Community

Discussion on: Google Cloud Functions: Sending emails using Gmail SMTP and Nodemailer

Collapse
 
i_maka profile image
Diego Perez

Hey there, thanks for asking!

"npm i --S nodemailer" has to be run on your local terminal, it will download the Nodemailer dependencies and update your package.json with the dependency. Your file should look like my package.json on the dependencies section.

Regarding the error, bear in mind that GCP expect you to export a method that will be run from the server, in this example I exported the method "sendMail()". Maybe is not very clear on the article, but you can check the final result of the file here. You will find the final method at the very end of the file.

Collapse
 
mahnoorgit profile image
Mahnoor-git

Thank So much for the humble reply .This issue is now resolved. Now i am facing an error {"error":{"code":422,"message":"Missing arguments"}} . G suite admin console require domain verification which i can not do , Can we use another way instead of using GSuite ?

Thread Thread
 
i_maka profile image
Diego Perez

Based on what you say, the error is possibly because you are not providing the api key... I'm afraid you will need to check if there is another way to authenticate GSuite and modify the code accordingly, but there is no option without verifying your domain, as far as I'm aware.

Thread Thread
 
mahnoorgit profile image
Mahnoor-git

Yeah seems like that.Anyways Thanks alot.