{"id":47947598,"url":"https://github.com/rumur/wp-mailer","last_synced_at":"2026-04-04T08:51:13.188Z","repository":{"id":62538169,"uuid":"272476132","full_name":"rumur/wp-mailer","owner":"rumur","description":"[WordPress] The Wrapper on top of `wp_mail` function. ","archived":false,"fork":false,"pushed_at":"2020-07-16T10:23:57.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T10:08:16.742Z","etag":null,"topics":["email-sender","email-template","mailer","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/rumur.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-06-15T15:31:05.000Z","updated_at":"2020-07-16T10:24:01.000Z","dependencies_parsed_at":"2022-11-02T15:30:22.245Z","dependency_job_id":null,"html_url":"https://github.com/rumur/wp-mailer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rumur/wp-mailer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumur%2Fwp-mailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumur%2Fwp-mailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumur%2Fwp-mailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumur%2Fwp-mailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rumur","download_url":"https://codeload.github.com/rumur/wp-mailer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumur%2Fwp-mailer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31393780,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: 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":["email-sender","email-template","mailer","wordpress"],"created_at":"2026-04-04T08:51:12.545Z","updated_at":"2026-04-04T08:51:13.180Z","avatar_url":"https://github.com/rumur.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# The Wrapper on top of [`wp_mail`](https://developer.wordpress.org/reference/functions/wp_mail/) function.  \n  \n## Package Installation  \n```composer require rumur/wp-mailer```  \n  \n### How to change `From Name` and `From Email`?\n```php \n\u003c?php\n\nuse Rumur\\WordPress\\Mailer\\Mailer;     \n\n// This will change it for all emails that being sent via that mailer. \nMailer::useAlwaysFromEmail('fromemail@domain.com');  \nMailer::useAlwaysFromName('More then a blog.');\n\n// However it can be changed per email only.\nMailer::make(wp_get_current_user(), 'My Blog.', 'testemail@blog.com')-\u003esend($mailable);\n\n```\n\n### [Create New Email Template](#new-email)\n```php\n\u003c?php  \n  \nnamespace App\\Emails;  \n  \nuse Rumur\\WordPress\\Mailer\\Mailable;  \nuse Rumur\\WordPress\\Mailer\\WordPressMailParams;  \n  \nfinal class Invoice extends Mailable  \n{  \n   /**  \n    * @var \\Order  \n    */  \n    protected $order;  \n    \n   /**  \n    * Invoice constructor. \n    * @param \\Order $order  \n    */  \n    public function __construct(\\Order $order)  \n    {  \n      $this-\u003eorder = $order;  \n    }  \n    \n   /**  \n    * Builds an email params. \n    * \n    * @return WordPressMailParams  \n    */  \n    public function build(): WordPressMailParams  \n    {  \n      // Takes Attached files from the order and converts into relative file paths  \n      $as_files = array_map(static function ($file) {  \n          return get_attached_file($file);  \n      }, $this-\u003eorder-\u003efile_ids);  \n    \n      $this-\u003esetAttachments($as_files);  \n    \n      // Also could be attached as id or an array of ids, will transform them to files.  \n      $this-\u003eaddAttachment($this-\u003eorder-\u003efile_ids);  \n    \n      // Also could be mixed  \n      $this-\u003eaddAttachment([  \n        $file_id = 2020,  \n        $file_path = WP_CONTENT_DIR . '/uploads/2020/05/lorem.png',  \n      ]);  \n    \n      // ⚠️ OPTIONAL ⚠️  \n      // The subject could be explicitly set or the Email class name will be taken as a subject.  \n      $this-\u003esubject(  \n         sprintf(_x('Invoice Number %d', 'Invoice Subject', 'text-domain'), $this-\u003eorder-\u003eid)  \n      );  \n    \n      return parent::build();  \n    }  \n    \n   /**  \n    * The Main message of an Email. \n    * @return string  \n    */  \n    public function body(): string  \n    {  \n      // TODO: Implement body() method.  \n    }  \n}\n```\n\n### [Basic Usage](#usage)\n```php\n\u003c?php\n\nuse Rumur\\WordPress\\Mailer\\Mailer;\nuse Rumur\\WordPress\\Mailer\\Dispatcher;  \nuse Rumur\\WordPress\\Mailer\\WordPressMailParams;\n\n$order = OrderRepository::find(214);  \n  \nMailer::instance()  \n     // ⚠️ OPTIONAL ⚠️  \n     // These local options will be used instead of always ones.  \n     -\u003efrom('Custom From Name', 'custom@domain.com')  \n    \n     // If `to` gets a \\WP_User instance,  \n     // it also will set the locale from user's data. \n     // You also allowed to pass a regular valid email as well.  \n     -\u003eto(wp_get_current_user())  \n    \n     // ⚠️ OPTIONAL ⚠️  \n     // Sets the Carbon Copy of the email.  \n     -\u003ecc(['carboncopy@domain.com', get_user_by('id', 2222)])  \n    \n     // ⚠️ OPTIONAL ⚠️  \n     // Sets the Blind Carbon Copy of the email.  \n     -\u003ebcc('blindcarboncopy@domain.com')\n    \n     // ⚠️ OPTIONAL ⚠️  \n     // Use the `locale` method in order to explicitly set the locale of the email,\n     // otherwise the locale will be taken from a user if a WP_USer has been passed via a `to` method\n     // ⚠️ Note once the email has been dispatched the main blog locale will be restored back\n     -\u003elocale('en_US')  \n    \n     // ⚠️ OPTIONAL ⚠️  \n     // This listener will be triggered in case of the mailer encountered with an error  \n     -\u003eonFailure(static function (\\WP_Error $error, WordPressMailParams $params, Dispatcher $dispatcher) {  \n         // Do something with that error.  \n     })\n     \n     // ⚠️ OPTIONAL ⚠️  \n     -\u003eonSuccess(static function (WordPressMailParams $params, Dispatcher $dispatcher) {  \n          // Do something with that information.  \n     })  \n    \n     // ⚠️ OPTIONAL ⚠️  \n     // The Email could be sent when a WordPress action has been fired.  \n     -\u003esendOnAction('user_payment_completed', new App\\Emails\\Invoice($order))  \n    \n     // ⚠️ OPTIONAL ⚠️  \n     // The Email could be sent when the condition is `true`.  \n     -\u003esendWhen($order-\u003eisPayed(), new App\\Emails\\Invoice($order)) \n    \n     // ⚠️ OPTIONAL ⚠️  \n     // This method requires a {@link https://github.com/rumur/wp-scheduling} package to be installed \n     // or as a third parameter you could pass a \\Closure that substitute a cron setup.\n     // The Email could be postponed by the specific time.\n     // The first parameter takes \\DateTimeInterface|int(timestamp)|string(any relative datetime for `strtotime`)\n     -\u003esendLater('tomorrow noon', new App\\Emails\\Invoice($order))\n     \n     // If sending options above did not meet your need\n     // There is the main method that dispatches the email.  \n     -\u003esend(new App\\Emails\\Invoice($order));\n\n```\n\n## License\nThis package is licensed under the MIT License - see the [LICENSE.md](https://github.com/rumur/wp-mailer/blob/master/LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumur%2Fwp-mailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frumur%2Fwp-mailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumur%2Fwp-mailer/lists"}