{"id":15672389,"url":"https://github.com/sebsept/fakesendmail","last_synced_at":"2026-03-10T15:32:29.008Z","repository":{"id":25904133,"uuid":"29344808","full_name":"SebSept/fakesendmail","owner":"SebSept","description":"A replacement for sendmail, for php debuging, testing","archived":false,"fork":false,"pushed_at":"2015-01-20T22:06:20.000Z","size":264,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"wip","last_synced_at":"2025-06-22T18:52:00.922Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/SebSept.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":"2015-01-16T10:56:36.000Z","updated_at":"2018-03-01T12:35:45.000Z","dependencies_parsed_at":"2022-08-24T14:16:39.572Z","dependency_job_id":null,"html_url":"https://github.com/SebSept/fakesendmail","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/SebSept/fakesendmail","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SebSept%2Ffakesendmail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SebSept%2Ffakesendmail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SebSept%2Ffakesendmail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SebSept%2Ffakesendmail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SebSept","download_url":"https://codeload.github.com/SebSept/fakesendmail/tar.gz/refs/heads/wip","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SebSept%2Ffakesendmail/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30340117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:03:31.997Z","status":"ssl_error","status_checked_at":"2026-03-10T15:01:30.431Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-10-03T15:25:18.511Z","updated_at":"2026-03-10T15:32:28.989Z","avatar_url":"https://github.com/SebSept.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fakesendmail\n\n![build status](https://api.travis-ci.org/SebSept/fakesendmail.svg)\n\n## What ?\n\nThis package/phar is a sendmail replacement. \n**It does not send email**, it stores them so that you can perform debugging or testing.\n(stored on `/tmp/lastmail` in json)\n\n## Why ?\n\nWas trying to test email sending (using a functionnal testing framework) : did my app sent a mail ? to the expected person, with the expected content ?\nI tried mailcatch (a ruby app), looks really great, but I've not seen anything else than ruby errors.\nI don't like ruby (because I don't know it probably, blame me if you want), I focus on php.\nI've started this mailcatch replacement.\n\n## How ?\n\nYou have to replace system sendmail app in php configuration with the one provided here.\n\nWhen a php script send a mail using `mail()` function, the mail is not sent, it is written in  `/tmp/lastmail`.\n( Stmp mails sent form you machine will continue to be sent, it changes only mail() behavior.)\n\n## Installation\n\n### Phar\n\n- download the [fakesendmail.phar](https://github.com/SebSept/fakesendmail/blob/wip/fakesendmail.phar?raw=true)\n- put it where php can execute it\n- make it executable `chmod a+x fakesendmail.phar` (for example).\n- update `php.ini` to use `fakesendmail.phar` so it may look like this :\n\n```ini\n...\n[mail function]\nsendmail_path = /usr/local/bin/fakesendmail.phar\n...\n```\n\nYou may need to restart apache `sudo apachectl restart` (maybe not needed).\n\n\n## Usage\n\nUse php to send a mail (or any class that can use it, as SwiftMailer or PhpMailer).\n\n```php\nmail ( 'seb@example.com' , 'my test mail' , 'here is the txt content.' );\n```\n\nThen you have a new file in your temporary dir with mail content. On linux, it could be '/tmp/lastmail' . \nThe content is in json.\n\nFor example : \n\n```json\n{\n\t\"date\":\"Wed, 30 Jan 2013 16:18:32 -0600\",\n\t\"to\":[{\"name\":\"\",\t\"address\":\"atapi@astrotraker.com\"}],\n\t\"cc\":[],\n\t\"bcc\":[{\"name\":\"\",\"address\":\"someone-in-bcc@somewhere.com\"},{\"name\":\"justin nainconnu\",\"address\":\"someoneelse-in-bcc@somewhere.com\"}],\n\t\"from\":{\"name\":\"Michael Smith\",\"address\":\"example@example.com\"},\n\t\"subject\":\"Fwd: test subject\",\n\t\"html_body\":\"\u003chtml\u003e...\u003c\\/html\u003e\",\n\t\"text_body\":\"\\n\\n--\\n\\nThanks,\\nMichael\\n\"\n}\n```\n\nYou can now easily perform unit tests after getting content : \n\n```php\n$tested_mail = json_decode( file_get_contents('/tmp/lastmail') );\n\n// you can now access a simple pretty StdClass\n$tested_mail-\u003edate; // (string) \"Wed, 30 Jan 2013 16:18:32 -0600\"\n$tested_mail-\u003eto; // array\n$tested_mail-\u003eto[0]-\u003eaddress; // (string) \"atapi@astrotraker.com\"\n\n```\n\nNo mail was really sent.\n\n## Configuration\n\nThe only option is the output file :\n\n```sh\nfakesendmail.phar --output /home/jack/dev/myproject/tests/lastsentmail.json\n```\n\nSo json will we written in /home/jack/dev/myproject/tests/lastsentmail.json\n\nAn exception will be thrown if php fails to write to the file (SebSept\\FakeSendmail\\FileWriterException)\n\n\n# Disclaimer\n\nVery early development stage : this is for local development use.\nI may not touch this anymore, since it does what I want it to do for the moment.\n\nDiscuss, ask, fork ;) \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebsept%2Ffakesendmail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsebsept%2Ffakesendmail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebsept%2Ffakesendmail/lists"}