Global

Methods

WEmail(optopt) → {Promise}

Description:
  • 寄送email

Source:
Example
import WEmail from 'w-email'

//opt
let opt = {
    srcName: 'test name',
    srcEmail: 'your email',
    srcPW: 'your password',
    emTitle: 'test title',
    emContent: '<h4>test head</h4>'+'<div>test content</div>',
    toEmails: 'to email',
    //toEmailsCC: 'to email',
    //toEmailsBCC: 'to email',
    emAttachments: {
        filename: 'your filename',
        path: 'your filepath'
    }
}

//WEmail
new WEmail(opt)
    .then((msg)=>{
        console.log('then',msg)
    })
    .catch((err)=>{
        console.log('catch',err)
    })
Parameters:
Name Type Attributes Default Description
opt * <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
srcName String <optional>
'system by w-email'

輸入寄件人顯示名稱字串,預設'system by w-email'

srcEmail String

輸入寄件人email信箱字串

srcPW String

輸入寄件人email密碼字串

srcHost String <optional>
'smtp.gmail.com'

輸入郵件伺服器位址,預設'smtp.gmail.com'

srcPort String <optional>
587

輸入郵件伺服器連接埠,預設587

emTitle String <optional>
''

輸入郵件名稱字串,預設''

emContent String <optional>
''

輸入郵件訊息字串,預設''

toEmails String | Array <optional>
[]

輸入收件人email字串或陣列,預設[]

toEmailsCC String | Array <optional>
[]

輸入副本收件人email字串或陣列,預設[]

toEmailsBCC String | Array <optional>
[]

輸入密件副本收件人email字串或陣列,預設[]

emAttachments Object | Array <optional>
[]

輸入附件物件或陣列,預設[],物件內需包含filename與path

Returns:

回傳Promise,resolve回傳成功訊息,reject回傳錯誤訊息

Type
Promise