10minutemail 中文文档教程
10minutemail Node API
用于从 10minutemail 创建和检索邮件的 API
npm install 10minutemail
Usage
var minutemail = require('10minutemail')
mail = minutemail({timeout: 10000, startup: true})
mail.on('address', (address) => console.log(address))
mail.on('mail', (mails) => console.log(mails[0].subject))
mail.on('count', (count) => console.log(count)
API
工厂返回一个 EventEmitter,每当事件发生时都会发出 3 个事件
var mail = minutemail([options])
创建一个新的 minutemail 发射器,一旦它稳定就开始一个连接,每 10 秒获取一次站点
选项包括:
{
timeout: 10000,
startup: true // setting this to false would only create the emitter and retrieve the email address created
}
Properties
mail.address
保存从 10minutemail.com 检索到的电子邮件地址。 这是一个异步获取,因此它可能不容易获得。 监听 address
事件。
Methods
mail.start()
开始从 10minutemail.com
mail.stop()
停止获取电子邮件并进行计数
Events
mail.on('address')
获取电子邮件并进行计数检索电子邮件地址时 。 检索后,地址存储在 EventEmitter 中,并作为 mail.address
进行访问
mail.on('mail')
当收件箱中有任何电子邮件
mail.on('count')
时发出每次计数请求时发出,如果为 0 则发出事件
10minutemail Node API
API to create and retrieve mail from 10minutemail
npm install 10minutemail
Usage
var minutemail = require('10minutemail')
mail = minutemail({timeout: 10000, startup: true})
mail.on('address', (address) => console.log(address))
mail.on('mail', (mails) => console.log(mails[0].subject))
mail.on('count', (count) => console.log(count)
API
The factory returns an EventEmitter that emits 3 events whenever they happen
var mail = minutemail([options])
Creates a new minutemail emitter that starts as soon as it stablishes a connection, and fetches the site every 10 seconds
Options include:
{
timeout: 10000,
startup: true // setting this to false would only create the emitter and retrieve the email address created
}
Properties
mail.address
Holds the email address retrieved from 10minutemail.com. This is an asynchronous fetch, so it may not be readily available. Listen for the address
event.
Methods
mail.start()
Starts fetching emails and counts from 10minutemail.com
mail.stop()
Stops fetching emails and counts
Events
mail.on('address')
Emitted when the email address is retrieved. After it retrieves, the address is stored in the EventEmitter and accessed as mail.address
mail.on('mail')
Emitted when there are any emails in the inbox
mail.on('count')
Emitted when for every count request, event if it is 0