{"id":18319757,"url":"https://github.com/redding/mailthis","last_synced_at":"2025-09-09T23:13:40.641Z","repository":{"id":710810,"uuid":"357540","full_name":"redding/mailthis","owner":"redding","description":"mailer for ruby","archived":false,"fork":false,"pushed_at":"2018-04-04T22:05:09.000Z","size":83,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-13T08:42:49.633Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/redding.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}},"created_at":"2009-11-02T01:30:50.000Z","updated_at":"2018-10-20T00:45:39.000Z","dependencies_parsed_at":"2022-07-05T10:02:28.250Z","dependency_job_id":null,"html_url":"https://github.com/redding/mailthis","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/redding/mailthis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fmailthis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fmailthis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fmailthis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fmailthis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redding","download_url":"https://codeload.github.com/redding/mailthis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fmailthis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274379787,"owners_count":25274232,"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","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-11-05T18:14:10.440Z","updated_at":"2025-09-09T23:13:40.570Z","avatar_url":"https://github.com/redding.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mailthis\n\n## Description\n\nConfigure and send email using Mail (https://github.com/mikel/mail) over Net:SMTP.\n\n## Usage\n\n### A basic example\n\n```ruby\nrequire 'mailthis'\n\nGMAIL = Mailthis.mailer do\n  smtp_helo   \"example.com\"\n  smtp_server \"smtp.gmail.com\"\n  smtp_port   587\n  smtp_user   \"test@example.com\"\n  smtp_pw     'secret'\nend\n\nGMAIL.deliver do\n  subject 'a message for you'\n  to      'you@example.com'\n  body    'here is a message for you'\nend\n```\n\n### A more complex example\n\n```ruby\nrequire 'mailthis'\n\nGMAIL = Mailthis.mailer do\n  smtp_helo   \"example.com\"\n  smtp_server \"smtp.gmail.com\"\n  smtp_port   587\n  smtp_user   \"test@example.com\"\n  smtp_pw     'secret'\n\n  smtp_auth \"plain\"                     # (optional) default: \"login\"\n  from      \"me@example.com\"            # (optional) default: `smtp_user` (if valid)\n  logger    Logger.new(\"log/email.log\") # (optional) default: no logger, no logging\nend\n\nmsg = Mailthis::Message.new\nmsg.from     = 'bob@example.com',       # (optional) default: mailer #from\nmsg.reply_to = 'bob@me.com',            # (optional) default: self #from\nmsg.to       = \"you@example.com\",\nmsg.cc       = \"Another \u003canother@example.com\u003e\",\nmsg.bcc      = [\"one@example.com\", \"Two \u003ctwo@example.com\u003e\"],\nmsg.subject  = \"a message\",\nmsg.body     = \"a message body\"\n\nGMAIL.deliver(msg)\n```\n\n### Disable sending mail\n\nYou can disable actually sending mail (in tests, non-production envs, etc) by setting the `MAILTHIS_DISABLE_SEND` environment variable.  For example:\n\n```ruby\nif !production?\n  # disable actually delivering emails when not in production\n  ENV['MAILTHIS_DISABLE_SEND'] = 'y'\nend\n```\n\nSet the env var to *any not-nil* value and mailthis will not send any mail.  It will do everything else, however, including logging the mail it would have sent and \"delivering\" the message in test mode (see below).\n\n### Test Mode\n\nWhen testing it is often nice to be able to check and see if your code delivered email or not.  Mailthis has a test mode where the mailer tracks\nthe messages it delivers.  Enable this with the env var `MAILTHIS_TEST_MODE`\nin your tests.\n\n```ruby\n# in your test helper or whatever\nENV['MAILTHIS_TEST_MODE'] = 'y'\n\n# in your tests or whatever\nshould \"email a notification\" do\n  assert_not_empty my_mailer.delivered_messages\n\n  msg = my_mailer.delivered_messages.last\n  exp_notification = Notification.new\n  assert_equal [exp_notification.to],    msg.to\n  assert_equal exp_notification.subject, msg.subject\n  assert_equal exp_notification.body,    msg.body.to_s\n  # or whatever your test logic may be, this is just an example\nend\n```\n\nSet the env var to *any not-nil* value to enable this mode.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'mailthis'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install mailthis\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredding%2Fmailthis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredding%2Fmailthis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredding%2Fmailthis/lists"}