Commit 3616be5 sourabh
committed
1 parent 12ed153 commit 3616be5 Copy full SHA for 3616be5
File tree 3 files changed +33
-4
lines changed
3 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -9,3 +9,8 @@ CLOUDINARY_NAME = djqf9vhkq
9
9
CLOUDINARY_API_KEY = 333799583579346
10
10
CLOUDINARY_API_SECRET = NQvSauVhU6fjJ5Wrd_GDqMHTVu4
11
11
12
+
13
+ SMTP_HOST = sandbox.smtp.mailtrap.io
14
+ SMTP_PORT = 2525
15
+ SMTP_USER = 950917e0029581
16
+ SMTP_PASS = ********4462
Original file line number Diff line number Diff line change @@ -161,11 +161,13 @@ Note: ALSO Allow PASSWORD Body itself
161
161
162
162
163
163
----------------------------------SECTION
164
- @LOCATION : 🗃️CONTROLLER/user.js
165
- @TITLE :->
166
- @ABOUT :->
167
-
164
+ @LOCATION : 🗃️utils/emailHelper
165
+ @TITLE :-> SENDING EMAIL
166
+ @ABOUT :-> nodemailer & mailtrap
168
167
@OVERVIEW @
168
+ 🔗✈️https://nodemailer.com/about/
169
+ 🔗✈️https://mailtrap.io/home
170
+ 🔗✈️https://courses.learncodeonline.in/learn/home/Pro-Backend-Developer-course/section/239125/lesson/1409394?
169
171
170
172
171
173
*/
Original file line number Diff line number Diff line change
1
+ const nodemailer = require ( "nodemailer" ) ;
2
+
3
+ const mailHelper = async ( options ) => {
4
+ const transporter = nodemailer . createTransport ( {
5
+ host : process . env . SMTP_HOST ,
6
+ port : process . env . SMTP_PORT ,
7
+ auth : {
8
+ user : process . env . SMTP_USER ,
9
+ pass : process . env . SMTP_PASS ,
10
+ } ,
11
+ } ) ;
12
+
13
+ const message = {
14
+ from : 'johndown@.dev' , // sender address
15
+ to : options . email , // list of receivers
16
+ subject : options . subject , // Subject line
17
+ text : options . message , // plain text body
18
+ } ;
19
+ await transporter . sendMail ( message ) ;
20
+ } ;
21
+
22
+ module . exports = mailHelper ;
You can’t perform that action at this time.
0 commit comments