temp-mail-fuck v1.0.8
README is available in the following languages: Russian | English
Temp Mail Fuck
temp-mail-fuck - Your best friend in the world of email.
Why ?
I am a very poor person, there are 14 people in my family and they are also poor can you imagine ? And my grandmother is generally 88 years old. We just can't afford to pay$ 19 for a fucking 1000 requests per month for some one-time mail. And what if really want to ? we accidentally noticed that, the most fashionable Cloudflare skips all the main api requests and decided to use it, thank you for this opportunity, now my family eats mailboxes! I hope my contribution will make it easier for someone life.
Get started
Install the npm module temp-mail-fuck
$ npm install temp-mail-fuck
or
$ yarn add temp-mail-fuck
or
$ npm install https://github.com/prohetamine/temp-mail-fuck
Examples and description
Connecting the module
const TempMailFuck = require('temp-mail-fuck')
TempMailFuck
The function TempMailFuck initializes the connection to Puppeteer takes two optional parameters, two objects and returns an object with the functions: kill, createMailbox, getMailboxByMail, getMailboxByToken. Don't forget to kill the Puppeteer process if you don't use the module with kill.
object
key | value | default value | mandatory | information |
---|---|---|---|---|
savePath | string | global.SPDCTMF | none | is used as a path for saving the post token |
object2
key | value | default value | required | information |
---|---|---|---|---|
any available Puppeteer | none-type | global.PDCTMF | none | is used to configure the Puppeteer launcher |
const TempMailFuck = require('temp-mail-fuck')
;(async () => {
// await TempMailFuck() or
const tmf = await TempMailFuck({
savePath: __dirname + '/myMailBox.json'
}, {
headless: true,
ignoreHTTPSErrors: true,
executablePath: '/usr/bin/chromium-browser', // your way to puppeteer
args: ['--disable-web-security', '--no-sandbox', '--disable-setuid-sandbox'],
})
console.log(tmf)
/* {
kill: [Function: kill],
createMailbox: [AsyncFunction: createMailbox],
getMailboxByMail: [Function: getMailboxByMail],
getMailboxByToken: [Function: getMailboxByToken]
} */
setTimeout(() => {
tmf.kill() // Kills the puppeteer process
}, 60000 * 10)
})()
createMailbox
The createMailbox function creates a new mailbox, you can interact with it through the functions getMessages, getMessagesInterval, findMessage, findMessageInterval, killMessagesInterval.
const TempMailFuck = require('temp-mail-fuck')
;(async () => {
const tmf = await TempMailFuck({
savePath: __dirname + '/myMailBox.json'
})
const mailbox = await tmf.createMailbox()
console.log(mailbox)
/* {
token: 'eyJhbGciOiJIUzI1NiIsInR5c ... xEFDD_TxGMVCnF1El5xIyPU',
mailbox: 'mesixa5696@obxstorm.com',
isOk: true,
getMessages: [AsyncFunction (anonymous)],
getMessagesInterval: [AsyncFunction: getMessagesInterval],
killMessagesInterval: [Function: killMessagesInterval],
findMessage: [AsyncFunction: findMessage],
findMessageInterval: [AsyncFunction: findMessageInterval]
} */
if (mailbox.isOk) {
// the mailbox was created successfully, so it can be used
const id = await mailbox.findMessageInterval(
({ from, subject, bodyPreview }) => from.match(/prohetamine/gi),
message => {
if (message.isFind) {
console.log(message)
}
},
5000
)
return setTimeout(() => {
mailbox.killMessagesInterval(id)
tmf.kill()
}, 60000)
} else {
// something went wrong...
}
setTimeout(() => {
tmf.kill()
}, 60000 * 10)
})()
getMailboxByMail
The function getMailboxByMail searches for a mailbox by mail passed by the first parameter, you can interact with it through the functions getMessages, getMessagesInterval, findMessage, findMessageInterval, killMessagesInterval.
getMailboxByMail - available only when there is a savePath.
parameters | default value | information |
---|---|---|
string | null | message search key |
const TempMailFuck = require('temp-mail-fuck')
;(async () => {
const tmf = await TempMailFuck({
savePath: __dirname + '/myMailBox.json'
})
const mailbox = await tmf.getMailboxByMail('mesixa5696@obxstorm.com')
console.log(mailbox)
/* {
token: null,
mailbox: null,
isOk: false,
getMessages: [AsyncFunction (anonymous)],
getMessagesInterval: [AsyncFunction: getMessagesInterval],
killMessagesInterval: [Function: killMessagesInterval],
findMessage: [AsyncFunction: findMessage],
findMessageInterval: [AsyncFunction: findMessageInterval]
} */
if (mailbox.isOk) {
// the mailbox was created successfully, so it can be used
const messages = await mailbox.getMessages()
console.log(await messages[0].getFullMessage())
} else {
// something went wrong...
}
setTimeout(() => {
tmf.kill()
}, 60000 * 10)
})()
getMailboxByToken
The function getMailboxByToken searches for a mailbox by the token passed by the first parameter, you can interact with it through the functions getMessages, getMessagesInterval, findMessage, findMessageInterval, killMessagesInterval.
getMailboxByMail - available only when there is a savePath.
parameters | default value | information |
---|---|---|
string | null | message search key |
const TempMailFuck = require('temp-mail-fuck')
;(async () => {
const tmf = await TempMailFuck({
savePath: __dirname + '/myMailBox.json'
})
const mailbox = await tmf.getMailboxByToken('eyJhbGciOiJIUzI1NiIsInR5c ... xEFDD_TxGMVCnF1El5xIyPU')
console.log(mailbox)
/* {
token: null,
mailbox: null,
isOk: false,
getMessages: [AsyncFunction (anonymous)],
getMessagesInterval: [AsyncFunction: getMessagesInterval],
killMessagesInterval: [Function: killMessagesInterval],
findMessage: [AsyncFunction: findMessage],
findMessageInterval: [AsyncFunction: findMessageInterval]
} */
if (mailbox.isOk) {
// the mailbox was created successfully, so it can be used
const messages = await mailbox.getMessages()
console.log(await messages[0].getFullMessage())
} else {
// something went wrong...
}
setTimeout(() => {
tmf.kill()
}, 60000 * 10)
})()
kill
The kill function kills the Puppeteer process and finishes TempMailFuck.
const TempMailFuck = require('temp-mail-fuck')
;(async () => {
const tmf = await TempMailFuck()
// your actions
setTimeout(() => {
tmf.kill()
}, 60000 * 10)
})()
getMessages
The getMessage function returns an array of emails, each of which contains only a preliminary message and the getFullMessage function that can be used to get the full message. It does not accept anything as parameters.
const TempMailFuck = require('temp-mail-fuck')
;(async () => {
const tmf = await TempMailFuck({
savePath: __dirname + '/myMailBox.json'
})
//const mailbox = await tmf.createMailbox()
const mailbox = await tmf.getMailboxByMail('rokanod348@biohorta.com')
//const mailbox = await tmf.getMailboxByToken('eyJhbGciOiJIUzI1NiIsInR5c ... xEFDD_TxGMVCnF1El5xIyPU')
console.log(mailbox.mailbox) // rokanod348@biohorta.com
if (mailbox.isOk) {
const messages = await mailbox.getMessages()
console.log(messages)
/* [
{
_id: '6104961ed1a97500a1c32d52',
receivedAt: 1627690527,
from: 'Stas Prohetamine <prohetamine@gmail.com>',
subject: null,
bodyPreview: ' Привет бедный человек ',
attachmentsCount: 0,
getFullMessage: [AsyncFunction (anonymous)]
}
] */
if (messages.length > 0) {
console.log(await messages[0].getFullMessage())
/* {
_id: '6104961ed1a97500a1c32d52',
receivedAt: 1627690527,
user: '46df74731e18464c89d55b2972669556',
mailbox: 'rokanod348@biohorta.com',
from: 'Stas Prohetamine <prohetamine@gmail.com>',
subject: null,
bodyPreview: ' Привет бедный человек ',
bodyHtml: '<div dir="ltr">Привет бедный человек</div>\n',
attachmentsCount: 0,
attachments: [],
createdAt: '2021-07-31T00:15:26.712Z'
} */
}
}
setTimeout(() => {
tmf.kill()
}, 60000 * 10)
})()
getMessagesInterval
The getMessagesInterval function returns an array of messages via callback with an interval of _N milliseconds, each of which contains only a preliminary message and the getFullMessage function that can be used to get the full message. As parameters, it takes callback as the first and only parameter to which it transmits messages, and takes the interval time in milliseconds as the second parameter.
parameters | default value | information |
---|---|---|
function | global.TMFFCB | callback function with an argument in the form of an array of letters |
number | 30000 | interval time in milliseconds |
const TempMailFuck = require('temp-mail-fuck')
;(async () => {
const tmf = await TempMailFuck({
savePath: __dirname + '/myMailBox.json'
})
//const mailbox = await tmf.createMailbox()
const mailbox = await tmf.getMailboxByMail('rokanod348@biohorta.com')
//const mailbox = await tmf.getMailboxByToken('eyJhbGciOiJIUzI1NiIsInR5c ... xEFDD_TxGMVCnF1El5xIyPU')
console.log(mailbox.mailbox) // rokanod348@biohorta.com
if (mailbox.isOk) {
const id = await mailbox.getMessagesInterval(async messages => {
console.log(messages)
/* [
{
_id: '6104961ed1a97500a1c32d52',
receivedAt: 1627690527,
from: 'Stas Prohetamine <prohetamine@gmail.com>',
subject: null,
bodyPreview: ' Привет бедный человек ',
attachmentsCount: 0,
getFullMessage: [AsyncFunction (anonymous)]
}
] */
if (messages.length > 0) {
console.log(await messages[0].getFullMessage())
/* {
_id: '6104961ed1a97500a1c32d52',
receivedAt: 1627690527,
user: '46df74731e18464c89d55b2972669556',
mailbox: 'rokanod348@biohorta.com',
from: 'Stas Prohetamine <prohetamine@gmail.com>',
subject: null,
bodyPreview: ' Привет бедный человек ',
bodyHtml: '<div dir="ltr">Привет бедный человек</div>\n',
attachmentsCount: 0,
attachments: [],
createdAt: '2021-07-31T00:15:26.712Z'
} */
}
}, 5000)
}
setTimeout(() => {
tmf.kill()
}, 60000 * 10)
})()
findMessage
The findMessage function returns the found message using the built-in callback filter of matches. In a successfully found email, there is only a preliminary message and the getFullMessage function that can be used to get the full message. It takes the callback function of the filter as parameters and passes the object of the preliminary message as the first and only parameter.
parameters | default value | information |
---|---|---|
function | global.TMFFCB | callback function with arguments in the form of keys of the preliminary letter object |
const TempMailFuck = require('temp-mail-fuck')
;(async () => {
const tmf = await TempMailFuck({
savePath: __dirname + '/myMailBox.json'
})
//const mailbox = await tmf.createMailbox()
const mailbox = await tmf.getMailboxByMail('rokanod348@biohorta.com')
//const mailbox = await tmf.getMailboxByToken('eyJhbGciOiJIUzI1NiIsInR5c ... xEFDD_TxGMVCnF1El5xIyPU')
console.log(mailbox.mailbox) // rokanod348@biohorta.com
if (mailbox.isOk) {
const prohetamine = await mailbox.findMessage(({ from, subject, bodyPreview }) => from.match(/prohetamine/gi))
console.log(prohetamine)
/* {
isFind: true,
message: {
_id: '6104961ed1a97500a1c32d52',
receivedAt: 1627690527,
from: 'Stas Prohetamine <prohetamine@gmail.com>',
subject: null,
bodyPreview: ' Привет бедный человек ',
attachmentsCount: 0,
getFullMessage: [AsyncFunction (anonymous)]
}
} */
if (prohetamine.isFind) {
console.log(await prohetamine.message.getFullMessage())
/* {
_id: '6104961ed1a97500a1c32d52',
receivedAt: 1627690527,
user: '46df74731e18464c89d55b2972669556',
mailbox: 'rokanod348@biohorta.com',
from: 'Stas Prohetamine <prohetamine@gmail.com>',
subject: null,
bodyPreview: ' Привет бедный человек ',
bodyHtml: '<div dir="ltr">Привет бедный человек</div>\n',
attachmentsCount: 0,
attachments: [],
createdAt: '2021-07-31T00:15:26.712Z'
} */
}
}
setTimeout(() => {
tmf.kill()
}, 60000 * 10)
})()
findMessageInterval
The findMessageInterval function returns the found message to callback2 using the built-in callback1 match filter with an interval of _N milliseconds. In a successfully found email, there is only a preliminary message and the getFullMessage function that can be used to get the full message. It takes the callback function of the filter as parameters and passes the object of the preliminary message as the first and only parameter.
parameters | default value | information |
---|---|---|
function | global.TMFFCB | callback function with arguments in the form of keys of the preliminary letter object |
function | global.TMFFCB | callback function with an argument in the form of an array of letters |
number | 30000 | interval time in milliseconds |
const TempMailFuck = require('temp-mail-fuck')
;(async () => {
const tmf = await TempMailFuck({
savePath: __dirname + '/myMailBox.json'
})
//const mailbox = await tmf.createMailbox()
const mailbox = await tmf.getMailboxByMail('rokanod348@biohorta.com')
//const mailbox = await tmf.getMailboxByToken('eyJhbGciOiJIUzI1NiIsInR5c ... xEFDD_TxGMVCnF1El5xIyPU')
console.log(mailbox.mailbox) // rokanod348@biohorta.com
if (mailbox.isOk) {
const id = await mailbox.findMessageInterval(
({ from, subject, bodyPreview }) => from.match(/prohetamine/gi),
async _message => {
console.log(_message)
/* {
isFind: true,
message: {
_id: '6104961ed1a97500a1c32d52',
receivedAt: 1627690527,
from: 'Stas Prohetamine <prohetamine@gmail.com>',
subject: null,
bodyPreview: ' Привет бедный человек ',
attachmentsCount: 0,
getFullMessage: [AsyncFunction (anonymous)]
}
} */
const { message, isFind } = _message
if (isFind) {
console.log(await message.getFullMessage())
/* {
_id: '6104961ed1a97500a1c32d52',
receivedAt: 1627690527,
user: '46df74731e18464c89d55b2972669556',
mailbox: 'rokanod348@biohorta.com',
from: 'Stas Prohetamine <prohetamine@gmail.com>',
subject: null,
bodyPreview: ' Привет бедный человек ',
bodyHtml: '<div dir="ltr">Привет бедный человек</div>\n',
attachmentsCount: 0,
attachments: [],
createdAt: '2021-07-31T00:15:26.712Z'
} */
}
},
5000
)
// mailbox.killMessagesInterval(id) // kills the interval
}
setTimeout(() => {
tmf.kill()
}, 60000 * 10)
})()
clearMessagesInterval
The function clearMessagesInterval kills either of the intervals findMessageInterval or getMessagesInterval. Accepts the interval ID as parameters.
parameters | default value | information |
---|---|---|
id | null | interval id |
const TempMailFuck = require('temp-mail-fuck')
;(async () => {
const tmf = await TempMailFuck({
savePath: __dirname + '/myMailBox.json'
})
const mailbox = await tmf.createMailbox()
if (mailbox.isOk) {
const id = await mailbox.getMessagesInterval(async messages => {
console.log(messages)
}, 5000)
setTimeout(() => {
mailbox.killMessagesInterval(id) // kills the interval
}, 30000)
}
setTimeout(() => {
tmf.kill()
}, 60000 * 10)
})()
Contacts
My Telegram: @prohetamine, channel
Email: prohetamine@gmail.com
Donat money: patreon
If you have any questions and/or suggestions, please email me in telegram, if you find any bugs also let me know, I will be very grateful.