{"id":13669150,"url":"https://github.com/tighten/mailthief","last_synced_at":"2025-04-27T01:32:41.812Z","repository":{"id":55881424,"uuid":"49821132","full_name":"tighten/mailthief","owner":"tighten","description":"A fake mailer for Laravel Applications for testing mail.","archived":true,"fork":false,"pushed_at":"2023-01-25T18:01:54.000Z","size":892,"stargazers_count":681,"open_issues_count":0,"forks_count":55,"subscribers_count":22,"default_branch":"main","last_synced_at":"2025-04-20T14:58:55.453Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tighten.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-17T14:42:00.000Z","updated_at":"2025-02-11T21:32:21.000Z","dependencies_parsed_at":"2023-02-14T10:00:57.469Z","dependency_job_id":null,"html_url":"https://github.com/tighten/mailthief","commit_stats":null,"previous_names":["tightenco/mailthief"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tighten%2Fmailthief","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tighten%2Fmailthief/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tighten%2Fmailthief/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tighten%2Fmailthief/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tighten","download_url":"https://codeload.github.com/tighten/mailthief/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251077102,"owners_count":21532607,"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":["hacktoberfest"],"created_at":"2024-08-02T08:01:04.200Z","updated_at":"2025-04-27T01:32:36.787Z","avatar_url":"https://github.com/tighten.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"[![Github Actions Status](https://github.com/tighten/mailthief/workflows/tests/badge.svg)](https://github.com/tighten/mailthief/actions)\n![MailThief Logo](https://raw.githubusercontent.com/tightenco/mailthief/main/mailthief-banner.png)\n\n# MailThief\n\nMailThief is a fake mailer for Laravel applications (5.0+) that makes it easy to test mail without actually sending any emails.\n\n#### Note: \nDue to changes in the way mail testing is handled by Laravel; MailThief is not needed for recent versions of the framework. MailThief will remain compatible with Laravel up to version 5.5.\n\n## Quickstart\n\nInstallation:\n\n```bash\ncomposer require tightenco/mailthief --dev\n```\n\nExample route:\n\n```php\nRoute::post('register', function () {\n    // \u003csnip\u003e Validation, create account, etc. \u003c/snip\u003e\n\n    Mail::send('emails.welcome', [], function ($m) {\n        $email = request('email');\n        $m-\u003eto($email);\n        $m-\u003esubject('Welcome to my app!');\n        $m-\u003efrom('noreply@example.com');\n        $m-\u003ebcc('notifications@example.com');\n        $m-\u003egetHeaders()-\u003eaddTextHeader('X-MailThief-Variables', 'mailthief');\n    });\n\n    // \u003csnip\u003e Return response \u003c/snip\u003e\n});\n```\n\nIf you're copying this sample test, remember to create an email view at `resources/views/emails/welcome.blade.php`.\n\nExample test:\n\n```php\nuse MailThief\\Testing\\InteractsWithMail;\n\nclass RegistrationTest extends TestCase\n{\n    // Provides convenient testing traits and initializes MailThief\n    use InteractsWithMail;\n\n    public function test_new_users_are_sent_a_welcome_email()\n    {\n        $this-\u003epost('register', [\n            'name' =\u003e 'John Doe',\n            'email' =\u003e 'john@example.com',\n            'password' =\u003e 'secret',\n        ]);\n\n        // Check that an email was sent to this email address\n        $this-\u003eseeMessageFor('john@example.com');\n\n        // BCC addresses are included too\n        $this-\u003eseeMessageFor('notifications@example.com');\n\n        // Make sure the email has the correct subject\n        $this-\u003eseeMessageWithSubject('Welcome to my app!');\n\n        // Make sure the email was sent from the correct address\n        $this-\u003eseeMessageFrom('noreply@example.com');\n\n        // Make sure a given header is set on an email\n        $this-\u003eseeHeaders('X-MailThief-Variables');\n\n        // Make sure the header is set to a given value\n        $this-\u003eseeHeaders('X-MailThief-Variables', 'mailthief');\n\n        // Make sure the email contains text in the body of the message\n        // Default is to search the html rendered view\n        $this-\u003eassertTrue($this-\u003elastMessage()-\u003econtains('Some text in the message'));\n        // To search in the raw text\n        $this-\u003eassertTrue($this-\u003elastMessage()-\u003econtains('Some text in the message', 'raw'));\n    }\n}\n```\n\nMailThief supports just about everything you can do with the regular Laravel `Mailer` and `Message` classes. More detailed documentation is coming soon, but in the mean time, explore the [MailThief](https://github.com/tightenco/mailthief/blob/master/src/MailThief.php) and [Message](https://github.com/tightenco/mailthief/blob/master/src/Message.php) classes to get an idea of what's available.\n\nIf you’re using the new Mailables syntax in Laravel 5.3, you can use the [native mail assertions](https://laravel.com/docs/master/mocking#mail-fake). But if you’re using the classic mail syntax in any version of Laravel, MailThief is still your best option.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftighten%2Fmailthief","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftighten%2Fmailthief","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftighten%2Fmailthief/lists"}