{"id":35190467,"url":"https://github.com/phrenotype/rotmailer","last_synced_at":"2026-05-20T06:42:38.080Z","repository":{"id":261901091,"uuid":"885601922","full_name":"phrenotype/rotmailer","owner":"phrenotype","description":"A simple PHP library that rotates email sending between multiple SMTP accounts to bypass sending limits.","archived":false,"fork":false,"pushed_at":"2024-11-08T23:14:44.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-24T06:57:02.890Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phrenotype.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":"2024-11-08T23:10:36.000Z","updated_at":"2024-11-08T23:18:46.000Z","dependencies_parsed_at":"2024-11-09T06:14:20.014Z","dependency_job_id":"9eaa30e5-56f6-4081-820c-d1560c5370e7","html_url":"https://github.com/phrenotype/rotmailer","commit_stats":null,"previous_names":["phrenotype/rotmailer"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/phrenotype/rotmailer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phrenotype%2Frotmailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phrenotype%2Frotmailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phrenotype%2Frotmailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phrenotype%2Frotmailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phrenotype","download_url":"https://codeload.github.com/phrenotype/rotmailer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phrenotype%2Frotmailer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28111192,"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-12-29T02:00:07.021Z","response_time":58,"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":"2025-12-29T05:38:39.683Z","updated_at":"2025-12-29T05:38:46.564Z","avatar_url":"https://github.com/phrenotype.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# RotMailer\n\nA simple PHP library that rotates email sending between multiple SMTP accounts to bypass sending limits.\n\n## Features\n- Randomized SMTP account selection for load balancing.\n- Supports single and multiple recipients.\n- Allows custom email content, including HTML and plain text.\n- Easily configurable and extendable.\n\n## Installation\n\nInstall the library using Composer:\n\n```bash\ncomposer require rotmailer/rotmailer\n```\n\n## Requirements\n- PHP 7.0 or higher\n- [PHPMailer](https://github.com/PHPMailer/PHPMailer)\n- Enabled `ext-dom` PHP extension (required by PHPMailer)\n\n## Usage\n\n### 1. Create SMTP Configuration\nDefine your SMTP accounts as an array of configurations:\n\n```php\n$smtpConfigs = [\n    [\n        'host' =\u003e 'smtp.example.com',\n        'username' =\u003e 'user1@example.com',\n        'password' =\u003e 'password1',\n        'encryption' =\u003e 'tls',\n        'port' =\u003e 587,\n        'from' =\u003e ['noreply@example.com', 'Example Support']\n    ],\n    [\n        'host' =\u003e 'smtp.another.com',\n        'username' =\u003e 'user2@another.com',\n        'password' =\u003e 'password2',\n        'encryption' =\u003e 'ssl',\n        'port' =\u003e 465,\n        'from' =\u003e ['noreply@another.com', 'Another Support']\n    ]\n];\n```\n\n### 2. Initialize `RotMailer`\nPass the SMTP configurations to the `RotMailer` class and start sending emails:\n\n```php\nrequire 'vendor/autoload.php';\n\nuse RotMailer\\RotMailer;\n\n$mailer = new RotMailer($smtpConfigs);\n\ntry {\n    $mailer-\u003erandomizeSMTP()\n           -\u003eaddRecipient('recipient@example.com')\n           -\u003esetSubject('Test Email')\n           -\u003esetBody('\u003ch1\u003eHello, World!\u003c/h1\u003e')\n           -\u003esend();\n\n    echo \"Email sent successfully!\";\n} catch (\\RuntimeException $e) {\n    echo \"Error: \" . $e-\u003egetMessage();\n}\n```\n\n## API\n\n### `__construct(array $smtpConfigs)`\nInitializes the `RotMailer` with an array of SMTP configurations.\n\n### `randomizeSMTP(int $debug = 0): self`\nSelects a random SMTP configuration and sets it for the email. Optionally enable debugging with `$debug`.\n\n### `setFrom(string $fromEmail, string $fromName): self`\nSets the \"From\" address.\n\n### `addRecipient(string $to): self`\nAdds a single recipient.\n\n### `addRecipients(array $recipients): self`\nAdds multiple recipients.\n\n### `setSubject(string $subject): self`\nSets the email subject.\n\n### `setBody(string $body, bool $isHTML = true): self`\nSets the email body. Supports both HTML and plain text.\n\n### `addAttachment(string $filePath, string $fileName = ''): self`\nAdds an attachment to the email.\n\n### `send(): bool`\nSends the email. Returns `true` on success or throws a `RuntimeException` on failure.\n\n## Testing\n\nRun the tests using PHPUnit:\n\n```bash\nphp vendor/bin/phpunit tests\n```\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request with your improvements.\n\n## License\n\nRotMailer is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphrenotype%2Frotmailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphrenotype%2Frotmailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphrenotype%2Frotmailer/lists"}