{"id":20282134,"url":"https://github.com/cemalgnlts/mailjs","last_synced_at":"2025-04-07T06:12:54.420Z","repository":{"id":46319729,"uuid":"368655827","full_name":"cemalgnlts/Mailjs","owner":"cemalgnlts","description":"This repo allows you to automate the registration process at the various sites which do require email confirmation for testing purposes.","archived":false,"fork":false,"pushed_at":"2024-01-17T08:40:42.000Z","size":216,"stargazers_count":108,"open_issues_count":6,"forks_count":19,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-31T05:06:24.764Z","etag":null,"topics":["mail","mail-api","temp-mail"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cemalgnlts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-18T20:16:12.000Z","updated_at":"2025-03-06T15:49:40.000Z","dependencies_parsed_at":"2023-01-20T07:23:11.016Z","dependency_job_id":"d0f378c0-110e-463f-85f5-7fec93ba08c4","html_url":"https://github.com/cemalgnlts/Mailjs","commit_stats":{"total_commits":84,"total_committers":4,"mean_commits":21.0,"dds":"0.16666666666666663","last_synced_commit":"7360e316d7df50717783bc6a37d89f375fe4fec2"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemalgnlts%2FMailjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemalgnlts%2FMailjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemalgnlts%2FMailjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemalgnlts%2FMailjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cemalgnlts","download_url":"https://codeload.github.com/cemalgnlts/Mailjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601449,"owners_count":20964864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mail","mail-api","temp-mail"],"created_at":"2024-11-14T14:08:11.820Z","updated_at":"2025-04-07T06:12:54.404Z","avatar_url":"https://github.com/cemalgnlts.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mailjs\n\nA JavaScript wrapper around the [mail.tm](https://docs.mail.tm/) api.\n\nProbably one of the best API for creating temporary email accounts.\n\n* Usage of our API for illegal activity is strictly prohibited.\n* It is forbidden to sell programs or earn from it that exclusively uses our API (for example, creating a competing temp mail client and charging for it's usage).\n* The general quota limit is 8 queries per second (QPS) per IP address.\n\n# Installation\n\n**npm**\n```sh\nnpm install @cemalgnlts/mailjs\n```\n\n**yarn**\n```sh\nyarn add @cemalgnlts/mailjs\n```\n\n**CDN**\n```\n\u003c!-- It is only needed to listen to new messages. --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/cemalgnlts/Mailjs@3.0.0/eventsource.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@cemalgnlts/mailjs@3.0.0/dist/mailjs.min.js\"\u003e\u003c/script\u003e\n```\n\n# Quickstart\n\n* Nodejs (CommonJS)\n```js \nconst Mailjs = require(\"@cemalgnlts/mailjs\");\n```\n\n* Nodejs (ESM)\n```js\nimport Mailjs from \"@cemalgnlts/mailjs\";\n```\n\n* Browser \n```html\n\u003c!-- You can exlude this if not listening to events. --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/cemalgnlts/Mailjs@3.0.0/eventsource.min.js\"\u003e\u003c/script\u003e\n\u003c!-- Mailjs library --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@cemalgnlts/mailjs@3.0.0/dist/mailjs.min.js\"\u003e\u003c/script\u003e\n```\n\n[`EventSourcePolyfill`](https://github.com/EventSource/eventsource) is only for listening to new incoming messages, see [Events](#events) title for more information. Add [`EventSourcePolyfill`](https://github.com/EventSource/eventsource) before Mailjs.\n\n\n```js\nconst mailjs = new Mailjs();\n\nmailjs.createOneAccount()\n\t.then(account =\u003e console.log(account.data));\n```\n\nFor more reference visit [/examples](/examples) directory.\n\n\n# Documentation\n\nReturns a Promise object after the function is called. If the request is sent correctly, `status` returns true. If it returns incorrect, the `status` will be false and the `message` in the data is also added. If there is no error, `status` always returns `true`.\n\nA successfull response example:\n\n```json\n{\n  \"status\": true,\n  \"message\": \"ok\",\n  \"data\": {}\n}\n```\n\nA failed response example:\n\n```json\n{\n  \"status\": false,\n  \"message\": \"Invalid credentials.\",\n  \"data\": {}\n}\n```\n\nExample use:\n\n```js\nconst acc = await mailjs.createOneAccount();\n\n// If there is a error.\nif(!acc.status) {\n  // Show the cause of the error.\n  console.error(acc.message);\n\n  return;\n}\n\n// If successful, access the data.\nconsole.log(acc.data);\n```\n\nTo see all results, check out the API page: [https://api.mail.tm/](https://api.mail.tm/).\n\n\nUser needs to login to access JWT token. Registration does not return this information, log in after registration.\n\n\nAfter the login process, the user's JWT token and ID are assigned to `mailjs.token` and `mailjs.id`\n\n---\n\n## Domain\n\n### List Domains\n```js\nmailjs.getDomains()\n  .then(console.log);\n```\n\n### Get Domain\n```js\nmailjs.getDomain(\"[domain id]\")\n  .then(console.log);\n```\n\n## Account\n\n### Create Account\n```js\nmailjs.register(\"user@example.com\", \"password\")\n  .then(console.log);\n```\n\n### Login\n\n`mailjs.token` and `mailjs.id` can be used to access the user token and id later.\n\n```js\nmailjs.login(\"user@example.com\", \"password\")\n  .then(console.log);\n```\n\n### Login With Token\n\nIf you use the JWT token stored in `mailjs.token` after login, it will allow you to login without username and password.\n\n```js\nmailjs.loginWithToken(\"eyJ0eXAiO...\")\n  .then(console.log);\n```\n\n### Get Account Data\n```js\nmailjs.me()\n  .then(console.log);\n```\n\n### Delete Account\n```js\nmailjs.deleteMe()\n  .then(console.log);\n```\n\nYou can also use the id to access the user's information and delete their account.\n\n```js\nmailjs.deleteAccount(\"[account id]\")\n  .then(console.log);\n```\n\n```js\nmailjs.getAccount(\"[account id]\")\n  .then(console.log);\n```\n\n## Message\n\n### List messages\nGets all the Message resources of a given page.\n\n```js\nmailjs.getMessages()\n  .then(console.log);\n```\n\n### Read a message\nRetrieves a Message resource with a specific id (It has way more information than a message retrieved with GET /messages but it hasn't the \"intro\" member)\n\n```js\nmailjs.getMessage(\"[message id]\")\n  .then(console.log);\n```\n\n### Delete a message\n```js\nmailjs.deleteMessage(\"[message id]\")\n  .then(console.log);\n```\n\n### Make a message readed or unreaded.\n`true` for make readed. `false` for make unreaded.\n\n```js\nmailjs.setMessageSeen(\"[message id]\", true)\n  .then(console.log);\n```\n\n## Events\nEvents are the **S**erver **S**ent **E**vents which are fired when message `arrive`, `seen` or `delete`. It also fires the `error`, `open` state.\n\n### on\nOpen an event listener to messages and error.\n\n```js\n// Add it before other activities if you need it.\nmailjs.on(\"open\", msg =\u003e console.log(\"Event listening has begun.\"));\n\n// When a new message arrives.\nmailjs.on(\"arrive\", msg =\u003e console.log(`Message id: ${msg.id} has arrived (${msg.intro}).`));\n\n// When a message is marked as read.\nmailjs.on(\"seen\", msg =\u003e console.log(`Message id: ${msg.id} marked as seen.`));\n\n// When a message is deleted.\nmailjs.on(\"delete\", msg =\u003e console.log(`Message id: ${msg.id} has been deleted.`));\n\n// If an error occurs during listening.\nmailjs.on(\"error\", err =\u003e console.error(\"Something went wrong:\", err));\n```\n\n### off\nClears the events and safely closes event listener.\n\n```js\nmailjs.off();\n```\n\n## Source\n\n### Get source\nGets a Message's Source resource (If you don't know what this is, you either don't really want to use it or you should [read this!](https://en.wikipedia.org/wiki/Email#Plain_text_and_HTML))\n\n```js\nmailjs.getSource(\"[message id]\")\n  .then(console.log)\n```\n\n## Helper Methods\n\n### Create random account.\n\nCreates and logs in an account with a random username and password.\n\n```js\nmailjs.createOneAccount()\n  .then(console.log);\n```\n\n#### Response\n\n```json\n{\n  \"status\": true,\n  \"message\": \"ok\",\n  \"data\": {\n    \"username\": \"user@example.com\",\n    \"password\": \"my-password\"\n  }\n}\n```\n\n# Questions And Suggestions\nIf you have any questions or suggestions, please contact us via email [support@mail.tm](mailto:support@mail.tm) or [discord](https://discord.gg/Mhw2PDZBdk).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcemalgnlts%2Fmailjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcemalgnlts%2Fmailjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcemalgnlts%2Fmailjs/lists"}