Node.js Express Gmail API Example to Send Messages With Image Attachments Using Nodemailer Library
Dec 9, 2025
Buy the full source code of the application at Paypal in USD Currency here:
https://procodestore.com/index.php/product/node-js-express-gmail-api-example-to-send-messages-with-image-attachments-using-nodemailer-library/
Show More Show Less View Video Transcript
0:01
Uh hello friends, today in this tutorial
0:02
I will be showing you that how to
0:04
integrate the Gmail API to send a email
0:07
address alongside with attachments. So
0:10
this is the application we will be
0:12
building where you will be sending out a
0:14
text email alongside with pictures as
0:16
well, pictures, text files as well. You
0:19
can also send PDF files as well. So we
0:21
will be showing you in this details step
0:22
by step how to do this process using
0:24
Gmail API and we will be using NodeJS
0:28
for this and for sending out the actual
0:31
email we will be using the library
0:33
called as node mailer you have seen this
0:35
library it's a very famous library in
0:37
NodeJS in order to send out any sort of
0:40
email address so 1 million weekly
0:42
downloads are there you will see we will
0:44
use this library so let's get started by
0:47
building this application so if you want
0:49
the full source code guys you can go to
0:51
the video description link. I have
0:53
written a complete detailed blog post on
0:55
my tutorial uh on my blog post. So if
0:59
you go to coding seaure uh the link I
1:02
have given this link in the video
1:04
description. This is a blog post. So I
1:06
will be following this blog post step by
1:08
step in this video. So make sure that
1:10
you go to the video description to
1:12
follow along with the video. [snorts]
1:14
And now guys, I will be
1:17
closing all the windows here and uh I
1:20
will
1:21
make a new directory here which will be
1:23
node Gmail and I will go to this
1:27
directory [snorts] and I will open this
1:30
directory inside the visual studio code.
1:33
You will see this is the editor I'm
1:34
using. So simply first of all you you
1:37
need to do is that you need to create
1:39
package.json file npm init-y. So this
1:42
will create the empty package dojson
1:44
file. And now you need to install the
1:46
node mailer library node mailer which is
1:49
the actual library which is sent which
1:51
is actually used to send email
1:53
addresses. And one other dependency you
1:55
can install which is - g for globally
1:58
nodemon which will automatically restart
2:00
your application.
2:02
I have already done that. So now we need
2:04
to create this index.js file. So we can
2:08
start this application nodemon index.js.
2:11
JS
2:13
and now first of all guys what you need
2:15
to do is that we need to require the
2:18
node mailer library. So we need to
2:20
require it node mailer
2:24
and here we will define some options
2:26
here. First we will declare some
2:28
variables which is uh const client ID
2:31
client ID. So all this information I
2:34
will tell you how to get this from your
2:36
Google cloud console account. Then we
2:38
need to get the client secret
2:43
and then
2:45
these are the two things we need to do.
2:47
So here just go to your Google cloud
2:50
console account here. So just go to
2:53
Google and here you will need the Google
2:55
cloud console account. I have already
2:57
sign up and uh verified the details. So
3:01
if you go to this Google cloud console,
3:03
the very first thing you need to do is
3:05
that go to APIs preview and uh you need
3:09
to enable the Gmail API. Click on enable
3:12
API services and search for the API
3:15
which is Gmail API
3:17
and you need to enable this Gmail API. I
3:20
I have already enabled this and after
3:23
enabling it you need to
3:28
create our credentials which is client
3:31
ID and client secret. Click on
3:33
credentials and simply you will click
3:37
this option which is create credentials.
3:39
Select oath client ID [snorts] and
3:42
simply you need to uh create the
3:44
credentials here.
3:47
the web application application type is
3:49
that and now inside authorize redirect
3:53
URI you need to add this uh uh
3:57
authorized URI if you go to the video
4:00
description link you will find this URL
4:04
uh
4:06
I think we don't need any of these
4:09
uh redirect URI I think we don't need
4:12
this so you just simply need to
4:16
uh don't need to fill out these details
4:19
authorize redirect URI or any of the
4:24
if you just want to let me just
4:27
uh have this
4:32
let me
4:34
I think this is a mandatory field I
4:36
think this needs to be filled out if I
4:39
don't add this so if I click this just
4:42
create this don't add any of these and
4:45
now you You see oath client is created.
4:48
This is your client ID and client
4:49
secret. This will be different for you.
4:51
So don't copy my client ID and client
4:53
secret. Simply paste it
4:57
like this. Paste it. Now you got our
5:00
client ID and client secret. So now we
5:03
can pass
5:05
we can create a function which will be
5:07
async function by default. Async
5:09
function and we can call this function
5:11
as send email. So which will actually
5:14
send out the email address. So inside
5:16
this we will do all the things inside a
5:18
try catch block.
5:22
So if any sort of error take place we
5:24
can just console log it.
5:29
So inside this try try block guys what
5:32
we need to do is that we need to create
5:34
a transport
5:37
variable and inside this we need to use
5:41
the node mailer transport create
5:44
transport method.
5:47
You can see this is a method which is
5:49
there and here we need to pass the
5:51
details. First the service is equal to
5:54
Gmail because we are sending out Gmail
5:57
emails.
5:59
And then there is a second field out
6:01
this O which is here we need to pass the
6:05
type parameter to
6:07
O2.
6:09
This is a authentication O2.
6:14
So you can see this just make it uh
6:17
small letters which is O2
6:20
and the second parameter which comes is
6:22
the user. User is actual email address.
6:25
So I will use my email address. So just
6:27
replace your email address from which
6:29
you will be sending out emails.
6:32
And then the third parameter is the
6:35
actual client ID guys which we have
6:37
created. So I will pass the client ID
6:39
and then the client secret.
6:42
So we will pass the client secret that
6:45
we have created. So these are four
6:47
properties. And now guys the third
6:49
property is access token. So access
6:51
token is the necessary thing. It's a
6:54
mandatory thing to actually send out
6:56
email address on user behalf. So access
6:59
token is nothing but it is granting
7:02
permission to the application so that it
7:05
can send out email addresses on your
7:07
behalf. So now to [snorts] generate this
7:09
access token it is pretty simple. I will
7:12
guide you the process here. Just search
7:14
for just first of all go to Google and
7:17
here type here Google oath
7:20
playground.
7:22
So simply type this and the very first
7:24
link which comes in you will see O2
7:26
playground
7:29
and here first you can see you can
7:31
generate access token for each and every
7:33
Google API. So you need to select uh
7:36
precisely our Gmail API. [snorts]
7:39
So you will see Gmail API version one.
7:41
Simply select this and now you need to
7:44
select your scope here. So there are
7:46
many scopes out there. So now to select
7:48
all the scopes we will select the first
7:50
option here which is mail.com and now
7:52
you need to click authorize APIs. So now
7:55
this will ask for the permission. Simply
7:57
select your Google account and grant the
7:59
permissions. Click on continue.
8:02
And now basically it will have your
8:04
authorization code. You need to exchange
8:06
this authorization code for token. And
8:09
now you will see your access token will
8:11
be there. This will be expiring after
8:14
3600 seconds. So you need to copy this.
8:17
So whenever it is expired you can always
8:19
click refresh access token. If you click
8:21
it it will generate a new access token.
8:24
So the expiration you will see this
8:26
expire in this much seconds. So every
8:29
time we need to repeat the same process.
8:33
And now inside this access token we can
8:35
paste it like this.
8:39
After pasting it now the job is
8:41
complete. Now we can
8:44
after this we can define some more
8:47
options which is mail options generally
8:50
from which declare this mail options
8:54
object. So inside this object we will
8:57
define from address which will be actual
9:00
address from which you will be sending
9:02
out. So we will be sending out from this
9:04
email which is my email and then we have
9:07
the two field to which of the email
9:10
address you will be sending out.
9:13
So I will be sending out this email. So
9:16
you can also send out to multiple
9:18
people. So just put a comma and you will
9:20
be sending out to multiple people. For
9:22
now I will be sending to a single
9:24
person. Then you can define the subject
9:26
as well. This is a test email
9:31
and after subject you can define the
9:34
actual body of the message. This is a
9:37
body of the message
9:41
and then you can also define the HTML
9:44
part as well.
9:47
Let's suppose we define in a heading
9:50
that uh hello from Gmail.
9:57
This is not mandatory this HTML thing
10:00
and uh if you want to also send out
10:02
attachment you can send out with a
10:04
attachment option but I will be showing
10:07
you in the next step how to do this. Uh
10:10
for now we will be sending out this
10:12
plain text message just to verify if it
10:14
is working or not.
10:20
And after that guys what we need to do
10:22
is that
10:24
we will declare another result variable.
10:27
And now inside this we will say await
10:30
and we will use the transport dot send
10:34
mail method here which is there inside
10:36
this library node mailer and we will
10:39
pass the mail options that we have
10:40
defined here. That's it.
10:45
So after this
10:49
we can uh return the result back to the
10:52
user
10:54
and that's it. This is all the function
10:56
which is there. Now in order to call
10:58
this function basically if you run this
11:00
nothing will happen because we just
11:01
return the function. We haven't called
11:03
this. Now we need to call this. So as
11:06
this is a uh async function it will be
11:09
returning the response in a promise. So
11:11
we need to write dot then and inside
11:15
this we will have the result
11:19
and
11:21
we can just here console lock
11:26
that email is sent
11:29
alongside with the response we can
11:31
concatenate result
11:35
and basically if any sort of error take
11:37
place we can catch it using this error
11:40
option.
11:42
And then we can say console log and
11:45
error occurred.
11:48
And then we can also concatenate the
11:50
error. That's it. [snorts]
11:53
So we can say error dot message.
11:59
[snorts]
12:00
Instead of console logging it, we can
12:02
also return error as well to the user.
12:04
That's it. So now we can launch this
12:06
application. So you will see email is
12:09
sent. It is already sending out the
12:11
email here. So I think we don't need to
12:14
use nodeborn here because multiple
12:17
emails can be sent. So basically if I
12:20
check it you will see hopefully we will
12:23
be receiving a message plain text
12:25
message.
12:43
Let me launch it once again.
12:50
[snorts] So it is saying email is sent.
12:59
Let me refresh it if it is actually sent
13:01
or not.
13:08
Uh guys the error was very simple here
13:11
you can see inside mail options inside
13:13
the two field we have we are missing
13:15
this com here we we just written here
13:17
geeky gotham 1997 at the rategmail. So
13:20
we also need to write com as well. So
13:23
this was the error. Now basically if you
13:25
want to run this application just type
13:27
node index.js.
13:29
Now you will see it will have uh the
13:32
email is sent here. And now we can
13:34
verify as well. This is the test email.
13:38
This is a subject here. I have two line
13:40
I have written here. This is the test
13:41
email. If I open this, you will see
13:44
hello from Gmail API. This is a heading
13:47
here. H1 heading. So you will see H1
13:50
heading. I can even change this to let's
13:52
suppose this is a second
13:56
test email
13:58
and I can make this a paragraph instead
14:01
of heading. So if I make this
14:08
and once again if I run this you will
14:10
see now this will send out this email.
14:15
So once again this is a second test
14:18
email and this is a paragraph here and
14:22
uh I don't know if you can embed images
14:26
or as well let me try if I want to embed
14:30
a image here. So I have an image here
14:34
which is inside free media tools. Let me
14:37
copy the image address and simply if I
14:40
have a image tag inside the source if I
14:42
paste the address
14:46
and if I have a break tag here
14:50
this is a image
14:54
I'm just trying out let me just see if
14:55
it is working or not if node mirror
14:58
allows this or not. So now if I once
15:02
again run this let's suppose
15:08
Let me check if it is sending out this
15:10
image. You will see now. You can also
15:13
see guys, you can also embed images as
15:16
well. Now you can also download this
15:17
image right here inside your computer.
15:20
[snorts] Simply you can see it's very
15:22
easy guys. You can embed any sort of
15:24
HTML. You can embed images. I think you
15:27
can also embed videos as well. Let's
15:29
suppose let me try out if you can also
15:33
embed uh YouTube videos as well.
15:36
So I think you can let me search for my
15:40
video
15:44
coding section.
15:49
So let's suppose I take the link here
15:52
and let me play this video and I let me
15:56
have the share. If you want to share
15:58
this
16:11
Let me copy this.
16:14
And uh if you just write this line as
16:17
well
16:20
and let me try to send this. So I think
16:23
this will also be as acting as a link as
16:26
well. So if you just again see here
16:35
now you can see that guys this is the
16:36
YouTube video is there you can play this
16:39
YouTube video as well. So you can send
16:41
out anything. You can send out links,
16:43
images, videos, all that stuff. Just
16:46
construct it inside a uh good HTML and
16:50
you can send out. And now I will be
16:52
talking about how to send out images,
16:55
PDF documents, all that stuff using this
16:58
attachments array.
17:00
Attachments. And here you this can be a
17:03
array of objects. First this is a
17:05
property. It holds the file name. So it
17:07
will be having file txt and then you can
17:10
have the content property. So here you
17:13
can just write anything. This is a text
17:15
file. This contains something.
17:21
And what you will find guys if you just
17:23
uh now send this email it will create a
17:26
text file automatically with this
17:28
content that you have defined here and
17:30
it will send out. And now if you check
17:33
here
17:35
now this will contain a filet txt file
17:37
here you will see this is a text file
17:40
this contains something. So it's very
17:42
easy simply you create it using
17:44
attachments array and then you provide
17:47
two properties which is file name which
17:49
is actual file name which is given to
17:51
send out as a attachment. Then the
17:53
second option is the actual content
17:55
inside this text file. And now basically
17:58
if you want to send out from a URL this
18:01
is also very easy. So we can say image
18:05
dot PNG and let's suppose there is a PDF
18:10
for image document. So there is a path
18:13
property. So here you can actually send
18:16
out the path. So simply I will copy
18:19
image address and paste this path here
18:21
like this.
18:23
Paste this path. And now you will see
18:26
what you will do. It it can also be a
18:29
PDF file as well. Let me
18:31
have a file dot PDF and I can have path.
18:37
So just search for a PDF document online
18:40
sample PDF document.
18:44
And this is a I think this is a PDF
18:46
document. So it's a simple PDF document.
18:49
So if you want to send this also, you
18:52
can also send this. So now if you
18:56
send this command node index.js
19:01
so it will take some time because these
19:03
are three files which are there. Email
19:04
is sent. So now if you check here your
19:07
email
19:09
hopefully these three files will be
19:10
there.
19:12
Now you will see that guys this is the
19:14
image is there from the
19:17
this is the same image. You can see that
19:19
and then we got the second file which is
19:22
file.txt. txt which we constructed and
19:24
this is a third PDF document which is
19:26
the same PDF document that you see here.
19:30
So you can send out video files as well
19:32
because uh video will take longer that
19:35
that is why I'm not showing you. And uh
19:38
the last thing that is remaining guys
19:40
you can also send out path images as
19:43
well. Let's suppose you have downloaded
19:45
image inside your machine here like
19:47
this. So
19:51
let me open this inside uh my file
19:57
explorer. So let's suppose you want to
20:04
send out a image which is stored inside
20:06
your computer. So in that scenario it is
20:08
very easy. Simply paste this image and
20:11
send out
20:13
image.
20:16
This is image dot
20:18
png.
20:20
So you will see this is the image you
20:21
need to send out. So this is pretty
20:23
simple.
20:25
So you will define here
20:28
file name. This will be the actual file
20:30
name which will be given to the so this
20:32
will be simply image.png
20:36
and uh then we have the path property
20:39
once again. So here you will give the
20:40
path. So it is there inside the same
20:44
directory. I think it should also be
20:45
image.png. If there is a in a separate
20:49
folder, you will get the full path. If
20:52
you run this file once again, hopefully
20:54
this will send out the email as well.
20:57
You will see email is sent. And now what
21:00
you will find out
21:04
this is a file is now transferred here.
21:06
You will see. So now I have shown you
21:09
all the scenarios guys how you can send
21:11
out emails using node mailer using Gmail
21:14
API. You just need to construct get
21:16
these two things which is client ID and
21:18
client secret.
21:20
And uh that's it. These are the two
21:22
things that you will need. I have shown
21:24
you the process and uh lastly you will
21:27
also need this access token. So this is
21:29
very easy. Simply go to O2 playground
21:33
and uh from this you can get the access
21:35
token for 3600 seconds and then again
21:38
you can refresh it like this. This is a
21:41
new access token.
21:43
So I think 3600 seconds is exactly equal
21:46
to let me just see
21:52
I [clears throat] think this is equal to
21:54
yes 1 hour completely. So it is there
21:57
for 1 hour. So you can just see how much
22:01
is there.
22:05
So now guys I can translate this to a
22:10
real application. I guess also if you
22:12
can turn this using express as the title
22:16
of the video. So it will take some time
22:19
but I can do this simply.
22:22
So install express and maltar dependency
22:26
also which lets you upload images.
22:34
So this is installed here. So
22:40
now we can make it
22:42
just require the express library
22:48
and we can have a port number which is
22:50
running process env port. If port is not
22:54
available then run on port uh 3000.
22:59
Then we can say app dot firstly we need
23:02
to create app express.
23:06
Then we can say app.tget. If you open
23:08
the homepage,
23:11
we can say here uh response dot send
23:13
file
23:16
which is d name plus uh index.html.
23:23
So in the same directory you can create
23:24
index html. So this will be a simple
23:27
form guys which will be
23:33
so it will be a simple form element form
23:37
method will be post
23:40
and encoding type will be multiart form
23:42
data because we will also be sending out
23:45
images here from this.
23:47
So the action will be simply slash send
23:50
email. So here
23:54
we will be having input type file and u
23:58
name will also be file and here we need
24:00
can select multiple we can select
24:02
multiple images multiple files
24:05
and then we can have a button to send
24:09
email
24:12
that's it
24:17
[snorts] I think this is all that you
24:19
will need inside your HTML button and
24:21
type submit because we know the address
24:23
from which we will be sending out email
24:25
addresses that will be static but we can
24:28
def uh send out email addresses oh sorry
24:31
files from this form as well. So for
24:34
storing the files we can define a public
24:37
inside public we can have uploads folder
24:41
and then we can make that static using
24:46
uh a method here which will be app dot
24:48
use express dot static
24:54
and uh we can import the path dependency
24:57
also which lets you join the paths.
25:02
So, it's a built-in dependency. You need
25:04
not have to install it. path dot join
25:09
der name plus uh public
25:14
slash uploads.
25:17
And now you can also import malter
25:20
dependency guys which will let you store
25:22
the files inside uh which you select
25:25
firstly on the server and then you can
25:27
get the path and send out it.
25:30
For Malter you need to define a storage
25:33
engine which is very much easy. So
25:36
basically if you just see
25:40
if I search for this Malter dependency
25:48
we have this Malter dependency.
25:50
Basically if you drag down you will find
25:53
this uh code here.
26:02
Or if you don't want to read the
26:03
documentation, you can simply type malar
26:07
uh including
26:09
uh extension of file stack overflow.
26:13
Stack overflow is a very good website
26:15
for having any sort of doubt in
26:17
programming. You will get all the source
26:20
code. You can see this is exactly what
26:22
we want here. The guy has already
26:24
answered this question.
26:27
So I find this website a lot more
26:29
helpful. So simply paste it. And here we
26:32
need to change our path which will be
26:34
public/uploads.
26:40
And uh then we are giving the file name
26:42
and random name every time the user lets
26:45
you upload this and we are also
26:47
including the extension also. So after
26:50
that we are passing it to the malter
26:52
engine which is storage to storage.
26:54
That's it.
26:56
And now we can make a post request app.
26:59
We can define that request send email
27:02
which we have defined inside the form.
27:04
Here you will see send email
27:09
and here we can say request response
27:14
and uh let me start the application node
27:17
more index.js.
27:19
So it will be not be started because we
27:22
haven't started the application. So make
27:24
sure that you start it
27:28
app.listen port number and then we can
27:32
have the call back saying that console
27:35
log app is listening on port
27:40
3000.
27:41
So now you will see it will say app is
27:44
listening. If you open this you will s
27:46
see the form which will be
27:51
choose files send email
27:54
and uh now inside this post request guys
27:58
what we need to do is that we need to
27:59
use our middleware which is upload
28:02
simply pass request response and error.
28:06
If any sort of error take place, you can
28:08
check for it and console log that uh
28:12
error
28:14
in uploading files
28:18
and then we can return
28:25
in the else block. What we can do is
28:26
that we can actually uh show the path to
28:29
the user [snorts] which is console log
28:32
request files because it will be a array
28:35
because multiple files are there and one
28:38
more thing we are remaining we need to
28:40
use multiple method here because we are
28:42
using multiple
28:44
uploading multiple files. So dot
28:47
multiple
28:53
sorry not here but uh here I think yeah
28:59
if you want to upload single uh yeah dot
29:03
multiple
29:08
let me see
29:13
yes I think this is the array method so
29:16
Here you will define how many files you
29:18
need to upload
29:23
multiple.
29:27
Let me check the documentation. If you
29:30
malt upload multiple
29:34
files. So let me see what is the syntax
29:37
actual syntax which is given.
29:43
Uh yes, you need to give the file name
29:45
which is the name attribute alongside
29:48
how many files you need to upload at
29:50
max. So I will be along allowing the
29:53
user to upload 100 files at max. This is
29:56
a name attribute which we have given
29:58
inside the form here which is name. So
30:00
this needs to be same.
30:02
And now we can run the application
30:05
simply.
30:11
In the meantime, what we can do is s we
30:13
can uh
30:15
just comment this code here
30:18
because let me comment this
30:25
and try this in a second.
30:29
And now let me try to upload a file
30:31
here. Let's suppose some images.
30:35
Let me try to upload these four files.
30:39
And uh now you can see that guys it all
30:43
the files are uploaded and they have
30:45
given their own path here which is uh we
30:47
need this property which is request.path
30:51
and you can see that all these files if
30:53
you check here all these files will be
30:54
uploaded first 2 3 4. [snorts] After
30:58
uploading it we need to simply send out
31:00
to the email. So this is very easy if I
31:04
just show you.
31:06
So now after uploading it
31:14
we will move all this code here in a
31:18
function I think.
31:23
So I can
31:26
let me first of all
31:29
stop this application.
31:32
So let me move all these lines to the
31:34
top here where we define our client
31:36
secret and client ID.
31:39
So this will come here right here at the
31:41
top
31:44
and uh this function which is async
31:46
function
31:51
uh here.
31:58
So here this line I will move this line
32:01
to the post request. So now when our uh
32:06
file is uploaded we can call this
32:08
function send email and here we can pass
32:12
our request
32:13
dot files array.
32:26
And we can get this using or I think let
32:30
me have a better approach in order to do
32:33
this.
32:34
So now to do this process guys it is
32:36
very easy. First of all I have figured
32:38
out the way here. So just declare a
32:41
variable right here at the top here
32:42
which will be called as paths. So this
32:45
will be a empty array for now. Here you
32:48
will see this is a array variable. This
32:50
will be empty. So here we will store all
32:52
the paths of the files which are
32:54
uploaded here. Let me delete all the
32:56
files here and start from scratch.
32:59
So inside the uploads folder I will
33:01
delete all the images. Let me delete it.
33:06
So now it is empty. So here we will
33:08
after having all this request do files.
33:14
Let me stop this application. So we will
33:17
make use of the for each loop.
33:21
So we will pass the array which is
33:23
request dotfiles. For each file we will
33:27
extract we will construct a object here
33:31
and push it. So there is a push method
33:34
inside a arrays as you know in order to
33:37
push a new element into it. So inside
33:40
this we will push a object which will
33:42
contain two properties. First will be
33:44
the file name and the file name will be
33:47
equal to the every time unique because
33:50
we will pass date dot now. So this will
33:52
be unique every time and then we will
33:54
concatenate file dot
33:57
and then we need to concatenate the
33:59
extension of the file which we can get
34:01
using path dot extension name and then
34:04
we can pass file dot original name.
34:08
That's it. put a comma and then we need
34:10
to mention the path here which will be
34:13
getting from file.path that's it.
34:17
So now if you just console log
34:20
simply
34:22
if you console log uh
34:25
paths here
34:28
let me comment this. So now you will see
34:32
we will have all the files which are
34:35
uploaded. it will have these two
34:37
properties file name and the actual
34:39
path.
34:40
Let me run this application.
34:45
So if I now
34:48
choose the files, let's suppose I choose
34:51
these two files.
34:53
And if you check the console, you will
34:55
see this is the array here. It it
34:57
contains two properties here. File name,
34:58
path. This is exactly what we want here.
35:01
So simply what we can do let me delete
35:05
these
35:09
and also stop this
35:15
and after having this we can pass this
35:17
paths array to this function which is
35:19
send email and here we can define this
35:23
we are receiving it so instead of the
35:25
static attachments array we can replace
35:27
it with this dynamic one so simply
35:30
replace it That's it. And now your
35:33
application is complete. So you can test
35:35
it. We can also change the subject that
35:38
uh this message contains
35:42
multiple
35:45
attachments.
35:53
This is body of attachment message.
36:03
So we can also delete this path here.
36:05
HTML path also we don't need this. So
36:09
now if you once again run this.
36:12
If you now select
36:16
choose files. If I select these four
36:20
images, if I click send email,
36:25
you will see now first of all it is
36:27
uploaded and now you will see email is
36:29
sent. So if you check here,
36:33
you can see this is a second test email.
36:44
You can see this message contains
36:46
multiple attachments. So this is a
36:48
message that we sent right now. You can
36:49
see it contains three four images that
36:52
we selected. Here you will see all these
36:54
images are successfully sent. So in this
36:57
way you can use the HTML form in order
36:59
to upload multiple attachments. This
37:02
cannot be only restricted to image
37:05
files. This can be anything video file,
37:07
PDF file, any file of your choice I have
37:10
shown you. So in this way you can do it.
37:13
And one more thing you can also after
37:16
that you can send out a response thing
37:18
also that email is sent.
37:22
Please check the inbox
37:26
and in case of any error you can also
37:29
see
37:34
error is there in sending messages.
37:40
So that way user will see how is the
37:43
progress.
37:47
So you will see please email is sent
37:49
please check the inbox.
37:53
If I once again repeat the process if I
37:56
only select this image send email.
38:04
You will see email is sent. Please check
38:05
the inbox.
38:07
So this is the way guys you can send out
38:11
uh emails through Gmail API in NodeJS
38:14
and express. I have shown you using node
38:16
mailer library from step by step. All
38:19
the source code will be there inside
38:21
video description. Please hit the like
38:22
button, subscribe the channel and I will
38:24
be seeing you in the next
