Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I'm working on a NestJs project where I'm trying to send emails using SendGrid and Nodemailer with Gmail account. I'm encountering two issues:
Emails sent through SendGrid are not being delivered to the
recipient's inbox. After checking SendGrid's activity feed, I found
that the emails were processed and received by SendGrid but Google
is not. I verified my email and turned off my firewall, but the
issue persists.
Emails sent through Nodemailer using a Google account are being
failed and returning socket errors. I tried configuring the SMTP
settings as per Google's documentation, but the issue persists.
Error: Client network socket disconnected before secure TLS connection was established
at connResetException (node:internal/errors:711:14)
at TLSSocket.onConnectEnd (node:_tls_wrap:1593:19)
at TLSSocket.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'ESOCKET',
path: undefined,
host: '172.253.63.109',
port: 3000,
localAddress: undefined,
command: 'CONN'
I'm not sure how to resolve these issues, and any help would be greatly appreciated. Here's some relevant information:
I'm using Ubuntu with WSL2 on Windows 11 as my development
environment.
I'm using the @sendgrid/mail
package for sending emails through
SendGrid and the nodemailer
package for sending emails through
Google.
I've already checked my spam folder, but there are no emails
there. I've also checked the logs of the NestJs server, and there are no errors or exceptions being thrown.
Any help or suggestions would be greatly appreciated. Thank you!
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.