nodemailer 使用時碰到的問題

2021-09-02 21:25:32 字數 1038 閱讀 7845

nodemailer包加入後出現如下問題:

fangdemacbook-air:ah fxc$ node ./server.js

/users/fxc/work-on-node/ah/node_modules/nodemailer/lib/mailer/index.js:31

compile: [(...args) => this._convertdataimages(...args)],

^^^syntaxerror: unexpected token ...

at exports.runinthiscontext (vm.js:53:16)

at module._compile (module.js:373:25)

at object.module._extensions..js (module.js:416:10)

at module.load (module.js:343:32)

at function.module._load (module.js:300:12)

at module.require (module.js:353:17)

at require (internal/module.js:12:17)

at object.(/users/fxc/work-on-node/ah/node_modules/nodemailer/lib/nodemailer.js:3:16)

at module._compile (module.js:409:26)

at object.module._extensions..js (module.js:416:10)

解決方案:

"engines":

在命令列 $node -v 發現我的本地nodejs版本是4.xx,太老了。感覺是這個問題,查詢如何公升級。

分兩步:

#sudo npm install -g n

#sudo n stable

再次檢視版本

#node -v

已經是9.xx

再次執行nodemailer,發現問題解決!!! cool

nodemailer使用問題

使用nodemailer傳送郵件,一直沒收到郵件,後來列印出error的資訊,發現是返回報錯碼501 await transporter.sendmail mailoptions,error,info store.hmset nodemail code code,expire email.smtp....

使用nodemailer發郵件

最近在學node,就想著node能不能像後台那樣傳送郵件,結果找到了nodemailer這個發郵件的外掛程式,下列 使用qq郵箱發郵件 use strict const nodemailer require nodemailer let transporter nodemailer.createtr...

android fragment使用時遇到的問題

1 在fragment中onactivityresult 中接收activity中返回的值 返回值必須這麼寫 resultcode getactivity result ok,若寫為resultcode result ok會報錯 2 設定 時,通常都要用載入了的檢視來進行findviewbyid 否...