

Hey Developers!
I have created a tutorial for sending emails from your deno project using third party module called smtp.
Introduction
- You can send email from your deno application.
- Where we use this thing?
- Sending verification email to the user after his registration on our project.
- Sending emails like monthly newsletter, blogs, etc.
Getting Started
Packages:
- SMTP third party module -https://deno.land/x/smtp/
- Dotenv third party module -https://deno.land/x/dotenv
Importing packages
import{SmtpClient}from"https://deno.land/x/smtp/mod.ts";import"https://deno.land/x/dotenv/load.ts";
- Creating an instance of SmtpClient
constclient=newSmtpClient();
- Accessing environmental variables
const{SEND_EMAIL,PWD,RECV_EMAIL}=Deno.env.toObject();
- Configuring & Creating the connection
constconnectConfig:any={hostname:"smtp.gmail.com",port:465,username:SEND_EMAIL,password:PWD,};awaitclient.connectTLS(connectConfig);
- Sending the e-mail to the rec. account
awaitclient.send({from:SEND_EMAIL,to:RECV_EMAIL,subject:"Welcome!",content:"Hi from Vuelancer!",});
- Finally, closing the smtp client connection
awaitclient.close();
Run the app
$deno run--allow-read--allow-env--allow-net server.ts
Or else clone this repo and sculpt it!
- you can find the entire code on my github account
Vuelancer / deno-email-smtp
Sending emails using smtp module in deno
Sending Emails using SMTP in Deno
Steps:
- Clone the repository.
- create .env file.
- Add SEND_EMAIL,PWD,RECV_EMAIL values to it.
- Visit yourhttps://myaccount.google.com if you're using gmail.
- In Security section, switch on theless secure access
Run the application using the follg. command
$ deno run --allow-read --allow-env --allow-net server.js
- I have uploaded a tutorial for this project in my youtube channelVuelancer
~ Thank You!
Support Me
Youtube Channel -https://www.youtube.com/channel/UC0hmXRqXYVO0mocVt5D3GkQ
Github -https://github.com/vuelancer
Patreon -https://patreon.com/vuelancer
Top comments(0)
Subscribe
For further actions, you may consider blocking this person and/orreporting abuse