IT |
ITmedia 総合記事一覧 |
[ITmedia News] 河野大臣の“影武者ロボ”登場 公の場で働き、見る人の反応探る実証実験へ |
https://www.itmedia.co.jp/news/articles/2210/21/news178.html
|
itmedia |
2022-10-21 19:45:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
無料のDeepL APIを使って英語論文をサクッと翻訳するツールを作った。【Python】 |
https://qiita.com/Cartelet/items/86957b662deda22beceb
|
deepl |
2022-10-21 19:42:26 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
[Chart.js]折れ線グラフの縦軸を反対にする方法 |
https://qiita.com/yamamo31/items/6bf66b38ca574fa79b1e
|
chartjs |
2022-10-21 19:02:04 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
RDS MySQL Workbench による import/export |
https://qiita.com/leomaro7/items/88b2ddfb4d3a90693b54
|
importexport |
2022-10-21 19:57:54 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
AWS EC2 Route53 Apacheで静的テストページアップロードまでまとめ2022 (How To Host a Static Website in EC2 instance) |
https://qiita.com/eeyore0721/items/b0ef350a1b2e92b64d6f
|
awsecrouteapache |
2022-10-21 19:52:01 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
[Chart.js]折れ線グラフの縦軸を反対にする方法 |
https://qiita.com/yamamo31/items/6bf66b38ca574fa79b1e
|
chartjs |
2022-10-21 19:02:04 |
技術ブログ |
Developers.IO |
GuardDutyログをS3クロスアカウントレプリケーションしてみた |
https://dev.classmethod.jp/articles/guardduty-crossaccount-replication/
|
guardduty |
2022-10-21 10:06:15 |
海外TECH |
MakeUseOf |
Create a Progress Bar in Python CLI |
https://www.makeuseof.com/python-cli-progress-bar-tqdm/
|
command |
2022-10-21 10:30:14 |
海外TECH |
MakeUseOf |
Instagram to Nudge Users to Be More Respectful |
https://www.makeuseof.com/instagram-to-nudge-users-to-be-more-respectful/
|
remind |
2022-10-21 10:20:59 |
海外TECH |
DEV Community |
Send email in Node.JS with Nodemailer using Gmail account |
https://dev.to/documatic/send-email-in-nodejs-with-nodemailer-using-gmail-account-2gd1
|
Send email in Node JS with Nodemailer using Gmail account Environment amp DependenciesNodemailer is a Node JS npm module for sending emails This has been the go to solution to most NodeJS developers for email delivery in their applications Ensure you have NodeJS installed as a run environment Prerequisites•Basic knowledge of JavaScript programming •Knowledge Node JS•A code editor such as VSCode Getting startedGo to your project directoryCreate package json file npm init yinstall dependenciesnpm i nodemailer screate entry file mailer file amp mail templatetouch index js mailer js mail template js Project StructureNB to use ES synthax import dependencies set type module in the package json file ImplementationNote To understand how to navigate the nodemailer codebase and understand how it is implemented I used askyourcode This will save you a lot of time looking for code snippets and implementations online mail jsIn this file you will first create your mail transporter object from nodemailer This This transporter object make use of the service you are will use for sending the emails the host and most important an auth object This object is basically your email id and email passwordimport nodemailer from nodemailer create reusable transporter object using the default SMTP transportconst transporter nodemailer createTransport service gmail host smtp gmail com port secure false auth user MAILID gmail com pass YOUR PASSWORD The next thing is to create a reusable SEND MAIL function This function should take two arguments the mail details and a callback function to handle reponse create reusable sendmail function params object options mail options to subject text html params function callback callback function to handle response const SENDMAIL async mailDetails callback gt try const info await transporter sendMail mailDetails callback info catch error console log error Export this function to make it accessible by any file you want to issue the SEND MAIL from export default SENDMAIL HTML TEMPLATE mail template js In most applications developers are required to send a styled email to meet the Application or company s theme This can be done in sending mails through nodemailer You will have to create you own styled HTML TEMPLATE Below is a sample of template and how to use it an email template that can be used with Nodemailer to send emailsconst HTML TEMPLATE text gt return lt DOCTYPE html gt lt html gt lt head gt lt meta charset utf gt lt title gt NodeMailer Email Template lt title gt lt style gt container width height padding px background color fff email width margin auto background color fff padding px email header background color color fff padding px text align center email body padding px email footer background color color fff padding px text align center lt style gt lt head gt lt body gt lt div class container gt lt div class email gt lt div class email header gt lt h gt EMAIL HEADER lt h gt lt div gt lt div class email body gt lt p gt text lt p gt lt div gt lt div class email footer gt lt p gt EMAIL FOOTER lt p gt lt div gt lt div gt lt div gt lt body gt lt html gt export default HTML TEMPLATE index jsThis is the entry file for sending the email This can be any file you want to execute your SEND MAIL command from Here you provide the details of the mail to be sent and finally make use of the SEND MAIL function from the mailer js fileSample email details and how to make use of the HTML Template createdimport HTML TEMPLATE from mail template js const message Hi there you were emailed me through nodemailer const options from TESTING lt sender gmail com gt sender address to someone gmail com receiver email subject Send email in Node JS with Nodemailer using Gmail account Subject line text message html HTML TEMPLATE message NB The html value can be simply the message text variable if you don t want to use any template Initiate the SEND MAIL command using the options object created import SENDMAIL from mailer js send mail with defined transport object and mail optionsSENDMAIL options info gt console log Email sent successfully console log MESSAGE ID info messageId Success Output Common ErrorsOn error commonly encounter sending email with nodemailer using gmail is the Application specific password required error Error Invalid login Application specific password required Learn more at https support google com mail p InvalidSecondFactor r abbesmedw gsmtp at SMTPConnection formatError PATH node modules nodemailer lib smtp connection index js at SMTPConnection actionAUTHComplete PATH node modules nodemailer lib smtp connection index js at SMTPConnection lt anonymous gt PATH node modules nodemailer lib smtp connection index js at SMTPConnection processResponse PATH node modules nodemailer lib smtp connection index js at SMTPConnection onData PATH node modules nodemailer lib smtp connection index js at TLSSocket SMTPConnection onSocketData PATH node modules nodemailer lib smtp connection index js at TLSSocket emit node events at addChunk node internal streams readable at readableAddChunk node internal streams readable at TLSSocket Readable push node internal streams readable code EAUTH response Application specific password required Learn more at n r abbesmedw gsmtp responseCode command AUTH PLAIN This error is due to a security layer google uses to protect your account You are required to create an App Password to use in this instance How to fix this ErrorLogin to your google account From the sidebar click on securityScroll down to Signing in with googleClick on App Passwords to Generate a new App PasswordThis will generate a character xxxx xxxx xxxx xxxx app password Finally Replace your actual password in the mailer js file with the generated password don t include the spaces This show fix the error Feel free to comment below if you encountered any error in implementing it Let s help each other ConclusionIn this article We only learnt how to implement sending email in NOdeJS with nodemail using Gmail ServiceYou can use askyourcode to explore the package codebase nodemailer for more ways to improve on the implementation on html templates Happy Hacking If you find this content helpful Please Like comment and share Follow us for more articles on NodeJS |
2022-10-21 10:31:50 |
Apple |
AppleInsider - Frontpage News |
How to move or hide the Dock in macOS |
https://appleinsider.com/inside/macos/tips/how-to-move-or-hide-the-dock-in-macos?utm_medium=rss
|
How to move or hide the Dock in macOSLearn how to easily change the size placement and even hide your Dock in macOS The macOS Dock is a handy place where you can store your most used applications and access applications and features currently in use Typically it sits at the bottom of your screen Read more |
2022-10-21 10:54:23 |
海外TECH |
CodeProject Latest Articles |
Using a win32 mutex to figure out if an application instance is the first one |
https://www.codeproject.com/Articles/5341982/Using-a-win32-mutex-to-figure-out-if-an-applicatio
|
Using a win mutex to figure out if an application instance is the first oneThis article shows how to use a win mutex during application startup to figure out if an application instance is the first one |
2022-10-21 10:47:00 |
海外科学 |
BBC News - Science & Environment |
Ugandan ivory trader sentenced to life in prison |
https://www.bbc.co.uk/news/world-africa-63343732?at_medium=RSS&at_campaign=KARANGA
|
species |
2022-10-21 10:44:58 |
医療系 |
医療介護 CBnews |
過労死防止白書コラムに「こころの耳」相談事例も-コロナ感染拡大に伴う業務負荷やハラスメントなど |
https://www.cbnews.jp/news/entry/20221021190740
|
厚生労働省 |
2022-10-21 19:30:00 |
金融 |
RSS FILE - 日本証券業協会 |
分別管理に関する監査法人等による監査の結果 |
https://www.jsda.or.jp/shiryoshitsu/toukei/kansagaikyo.html
|
監査法人 |
2022-10-21 10:12:00 |
金融 |
金融庁ホームページ |
入札公告等を更新しました。 |
https://www.fsa.go.jp/choutatu/choutatu_j/nyusatu_menu.html
|
公告 |
2022-10-21 11:00:00 |
ニュース |
BBC News - Home |
Tory leadership: Hopefuls jostle for MPs' support |
https://www.bbc.co.uk/news/uk-politics-63338171?at_medium=RSS&at_campaign=KARANGA
|
truss |
2022-10-21 10:36:30 |
ニュース |
BBC News - Home |
Labour MP Christian Matheson resigns over sexual misconduct |
https://www.bbc.co.uk/news/uk-politics-63344752?at_medium=RSS&at_campaign=KARANGA
|
parliamentary |
2022-10-21 10:56:27 |
ニュース |
BBC News - Home |
Pound sinks as UK economic uncertainty rises |
https://www.bbc.co.uk/news/business-63340725?at_medium=RSS&at_campaign=KARANGA
|
figures |
2022-10-21 10:53:13 |
ニュース |
BBC News - Home |
Italy on verge of new government despite row |
https://www.bbc.co.uk/news/world-europe-63327290?at_medium=RSS&at_campaign=KARANGA
|
putin |
2022-10-21 10:07:17 |
ニュース |
BBC News - Home |
Netflix adds disclaimer under The Crown's trailer for series five |
https://www.bbc.co.uk/news/entertainment-arts-63341010?at_medium=RSS&at_campaign=KARANGA
|
twitter |
2022-10-21 10:38:25 |
ニュース |
BBC News - Home |
Could Boris Johnson really make a comeback? |
https://www.bbc.co.uk/news/uk-politics-63342114?at_medium=RSS&at_campaign=KARANGA
|
downing |
2022-10-21 10:41:29 |
ニュース |
BBC News - Home |
Falling pound: What does it mean for me and my finances? |
https://www.bbc.co.uk/news/business-63033110?at_medium=RSS&at_campaign=KARANGA
|
falling |
2022-10-21 10:47:03 |
北海道 |
北海道新聞 |
日体大・矢沢に稲葉GM「オンリーワン目指して」 日ハムがドラフト1位指名あいさつ |
https://www.hokkaido-np.co.jp/article/748827/
|
日本ハム |
2022-10-21 19:01:47 |
コメント
コメントを投稿