This project demonstrates the implementation of an email notification system using Nodemailer to send welcome emails with attachments to new users of the MusCo Blog application. The system supports sending emails via Gmail and includes attachments such as PDF and image files.
- Node.js
- Express.js
- Nodemailer
- dotenv
- path
backend-emails
├── .env
├── MusCo.png
├── MusCo.pdf
├── README.md
├── mail.js
├── package.json
└── server.js
Create a .env
file in the root directory with the following:
MAIL_SERVICE=gmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USER=<your_email@gmail.com>
MAIL_PASS=your_email_password
PORT=3007
-
Clone the repository:
git clone https://github.com/yourusername/backend-emails.git cd backend-emails
-
Install dependencies:
npm install
-
Set up environment variables: Create a .env file and add the required variables as described above.
-
Run the application:
node server.js
Send a GET request to /email-send to trigger the email sending functionality, which will include a welcome message and attachments (MusCo.png and MusCo.pdf):
http://localhost:3007/email-send
This project is licensed under the MIT License.
*** Feel free to customize this README file to better suit your project's specific details and requirements.