This project is made for send emails throug nest framework with nodemailer dependecie and use Ethereal mail to send the message (https://ethereal.email), for run this project basic and fast it is important that you enter in this page and create a new mail and click in the boton (Create Ethereal Account) then you copy the Nodemailer Configuration and modify the app module in the transport, disclaimer: the message is only read in this website
In another instance if you want to send message in Gmail you have to activate two factor auth and the password for divices it is necessary to add in app module that credentials
- Nodemailer
npm install nodemailer
- Nodemailer types
npm install --save @types/nodemailer
- Validator and Transformer to validate DTO
npm install --save class-validator class-transformer
- Environment variable
npm install --save dotenv
- Serve Static
npm install --save @nestjs/serve-static
Open CMD and search and open the project folder, run:
npm run start:dev
In my case I use Postman but you can use any other aplication to try your Url Post
http://localhost:3000/email/send
Body, raw, JSON
{
"toemail": "youremail@address.com",
"sub": "Subject",
"message": "Message"
}