Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
guerrillamail-api
Advanced tools
A Promise-based Javascript wrapper for the Guerrillamail API.
npm install guerrillamail-api
Important: Once you instantiate the class, you must wait for the API to register a random email address. This is still the case, even if you are using a custom email address.
The class will emit the emailAddress
event when an email address has been successfully registered with the API. Read more about the available event methods.
import GuerrillaMailApi from 'guerrillamail-api';
const GuerrillaApi = new GuerrillaMailApi();
GuerrillaApi.on('emailAddress', result => {
GuerrillaApi.getEmailList().then(result => {
// ...
});
});
It is possible to connect to a specific inbox by setting emailUser
in the config object when you instantiate the class. See config section.
const GuerrillaApi = new GuerrillaMailApi({
emailUser: 'sampleusr'
});
Use pollStart()
to start polling the inbox for new emails.
As with all methods which interact with the API, you must call the pollStart()
method after the API has registered an email address.
GuerrillaApi.on('emailAddress', result => {
// Begin polling for new emails after the email address has been registered
GuerrillaApi.pollStart();
});
Wait for the poller to emit the newEmail
event:
GuerrillaApi.on('newEmail', result => {
// You got mail!
});
pollInterval
when you instantiate the class.Pass config options when instantiating the wrapper.
Config Property | Type | Default | Description |
---|---|---|---|
emailUser | Boolean|String | false | Connect to a specific inbox, otherwise the API will assign you a random inbox. |
pollInterval | Number | 20000 | How often (in milliseconds) to poll for new emails. |
const GuerrillaApi = new GuerrillaMailApi({
emailUser: 'sampleusr'
pollInterval: 15000
});
Methods for the API endpoints from the official API documentation.
Important: Do not pass an sid_token
to any methods. Guerrilla Mail API Wrapper will take care of this internally.
Register a new random email address with the API.
API function: get_email_address
.
GuerrillaApi.getEmailAddress().then(result => {
// ...
});
Register a custom email user with the API.
API function: set_email_user
.
GuerrillaApi.setEmailUser({
email_user: 'sampleusr'
}).then(result => {
// ...
});
Get a maximum of 20 messages from the specified offset.
API function: get_email_list
.
GuerrillaApi.getEmailList({
offset: 0
}).then(result => {
// ...
});
Get emails that are older (lower ID) than the given email ID (where seq
is the ID).
API function: get_older_list
.
GuerrillaApi.getOlderList({
seq: 815
}).then(result => {
// ...
});
API function: check_email
.
Check for new email on the server.
GuerrillaApi.checkEmail({
seq: 456
}).then(result => {
// ...
});
API function: fetch_email
.
Get the contents of an email by ID.
GuerrillaApi.fetchEmail(789).then(result => {
// ...
});
Forget the current registered email address.
API function: forget_me
.
GuerrillaApi.forgetMe().then(result => {
// ...
});
Delete the emails from the server by ID.
API function: del_email
.
GuerrillaApi.delEmail(123, 456, 789).then(result => {
// ...
});
Methods for controlling the polling interval.
Start polling for new emails every x milliseconds, as defined by pollInterval
.
See event examples of how to react when new emails are received.
GuerrillaApi.pollStart();
Stop polling for new emails.
GuerrillaApi.pollStop();
Resume polling for new emails.
GuerrillaApi.pollPlay();
Pause polling for new emails.
GuerrillaApi.pollPause();
Destroy the poller.
GuerrillaApi.pollDestroy();
Destroy the poller and make the API forget the current email address (like you were never here!).
GuerrillaApi.destroy();
Guerrilla Mail API Wrapper extends EventEmitter3 which means you have access to an .on()
method. This is useful for listening for events, such as when a new email is received, or when the email address has been assigned by the API.
See full list of emitted events in the event reference table.
GuerrillaApi.on('newEmail', newEmails => {
// Do stuff with the new emails
});
Event strings are emitted in certain situations, which can be listened for using the .on()
method.
Important: The key event to listen for is emailAddress
. This means the API has registered the inbox and is ready.
GuerrillaApi.on('emailAddress', emailAddressDetails => {
GuerrillaApi.pollStart(); // Start polling for new emails
});
GuerrillaApi.on('emailAddressError', error => {
// Email address wasn't assigned
});
GuerrillaApi.on('newEmail', newEmails => {
// You got mail!
});
Event string | Emission reason |
---|---|
emailAddress | An email address has been assigned by the API. |
emailAddressError | An email user or address request errors. |
newEmail | New email has been received. |
pollRequestStart | A poll request is attempted. |
pollRequestComplete | A poll request has been completed. |
pollRequestError | A poll request has an error. |
[1.2.2] - 2019-02-14
FAQs
A JavaScript promise-based wrapper for the Guerrilla Mail API
The npm package guerrillamail-api receives a total of 4,371 weekly downloads. As such, guerrillamail-api popularity was classified as popular.
We found that guerrillamail-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.