{"id":49880098,"url":"https://github.com/pardnio/php-mailer","last_synced_at":"2026-05-15T13:40:47.780Z","repository":{"id":311426423,"uuid":"1043659102","full_name":"pardnio/php-mailer","owner":"pardnio","description":"(PHP Libaray) PHPMailer wrapper","archived":false,"fork":false,"pushed_at":"2025-08-24T11:14:41.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-24T17:35:29.469Z","etag":null,"topics":["backend","pardnchiu","php","php-library","phpmailer","wrapper-library"],"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/pardnio.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,"zenodo":null}},"created_at":"2025-08-24T10:51:19.000Z","updated_at":"2026-04-05T18:05:33.000Z","dependencies_parsed_at":"2025-08-24T17:03:54.593Z","dependency_job_id":"0a7529c9-da0f-42f6-9da0-fdd3a2f0ef89","html_url":"https://github.com/pardnio/php-mailer","commit_stats":null,"previous_names":["pardnchiu/php-mailer","pardnio/php-mailer"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pardnio/php-mailer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pardnio%2Fphp-mailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pardnio%2Fphp-mailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pardnio%2Fphp-mailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pardnio%2Fphp-mailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pardnio","download_url":"https://codeload.github.com/pardnio/php-mailer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pardnio%2Fphp-mailer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33068889,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"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":["backend","pardnchiu","php","php-library","phpmailer","wrapper-library"],"created_at":"2026-05-15T13:40:47.699Z","updated_at":"2026-05-15T13:40:47.762Z","avatar_url":"https://github.com/pardnio.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Mailer\n\n\u003e Lightweight PHP mail client with SMTP support, automatic configuration management, and complete email functionality.\u003cbr\u003e\n\u003e Built on PHPMailer, providing stable and reliable email delivery experience.\n\n[![packagist](https://img.shields.io/packagist/v/pardnchiu/mailer)](https://packagist.org/packages/pardnchiu/mailer)\n[![version](https://img.shields.io/github/v/tag/pardnchiu/php-mailer?label=release)](https://github.com/pardnchiu/php-mailer/releases)\n[![license](https://img.shields.io/github/license/pardnchiu/php-mailer)](LICENSE)\u003cbr\u003e\n[![readme](https://img.shields.io/badge/readme-EN-white)](README.md)\n[![readme](https://img.shields.io/badge/readme-ZH-white)](README.zh.md)\n\n- [Three Core Features](#three-core-features)\n  - [Automatic Configuration Management](#automatic-configuration-management)\n  - [Bulk Sending Support](#bulk-sending-support)\n  - [Stable Connection](#stable-connection)\n- [Features](#features)\n- [Usage](#usage)\n  - [Installation](#installation)\n  - [Environment Variables Setup](#environment-variables-setup)\n  - [Basic Usage](#basic-usage)\n- [API Reference](#api-reference)\n  - [Basic Sending](#basic-sending)\n  - [Bulk Sending](#bulk-sending)\n- [Error Handling](#error-handling)\n- [License](#license)\n- [Author](#author)\n\n## Three Core Features\n\n### Automatic Configuration Management\nAutomatically configure connection parameters based on environment variables, supporting multiple SMTP services\n\n### Bulk Sending Support\nSupport bulk email sending functionality, suitable for system notifications and high-volume sending needs\n\n### Stable Connection\nBuilt-in error handling and automatic cleanup mechanisms to ensure reliable email delivery\n\n## Features\n\n- **Environment Variable Configuration**: Flexible environment variable setup supporting multi-environment deployment\n- **SMTP Support**: Support for multiple SMTP services with automatic encryption configuration\n- **HTML/Plain Text**: Support for both HTML and plain text email formats\n- **Multiple Recipients**: Support for multiple recipients, CC, and BCC\n- **Priority Settings**: Support for high, normal, and low priority email sending\n- **Bulk Sending**: Built-in bulk sending functionality for improved sending efficiency\n- **Automatic Cleanup**: Automatic cleanup of recipient lists after sending\n\n## Usage\n\n### Installation\n\n```shell\ncomposer require pardnchiu/mailer\n```\n\n### Environment Variables Setup\n\n```env\nMAIL_SERVICE=smtp.gmail.com          # SMTP server\nMAIL_SERVICE_USER=your@email.com     # Sender account\nMAIL_SERVICE_PASSWORD=your_password  # Password or app password\nMAIL_SERVICE_PORT=587                # SMTP port (465/587/25)\nMAIL_SERVICE_CHARSET=UTF-8           # Character encoding\n```\n\n### Basic Usage\n\n**Method 1: Static Call (Recommended)**\n\n```php\n\u003c?php\n\nuse pardnchiu\\Mailer;\n\n// Direct static call\n$result = Mailer::send([\n  \"email\"     =\u003e \"recipient@example.com\",\n  \"subject\"   =\u003e \"Test Email\",\n  \"body\"      =\u003e \"\u003ch1\u003eThis is a test email\u003c/h1\u003e\",\n  \"isHtml\"    =\u003e true\n]);\n\nif ($result) {\n  echo \"Email sent successfully\";\n} else {\n  echo \"Email sending failed\";\n}\n```\n\n**Method 2: Instance Call**\n\n```php\n\u003c?php\n\nuse pardnchiu\\Mailer;\n\n// Initialize mail client\n$mailer = new Mailer();\n\n// Basic email sending (calling static method through instance)\n$result = $mailer::send([\n  \"email\"     =\u003e \"recipient@example.com\",\n  \"subject\"   =\u003e \"Test Email\",\n  \"body\"      =\u003e \"\u003ch1\u003eThis is a test email\u003c/h1\u003e\",\n  \"isHtml\"    =\u003e true\n]);\n\nif ($result) {\n  echo \"Email sent successfully\";\n} else {\n  echo \"Email sending failed\";\n}\n```\n\n## API Reference\n\n### Basic Sending\n\n**Mailer::send($config)** - Send single email (static call)\n\n```php\n$result = Mailer::send([\n  \"email\"     =\u003e \"recipient@example.com\",          // Recipient (required)\n  \"subject\"   =\u003e \"Email Subject\",                  // Subject (required)\n  \"body\"      =\u003e \"Email Content\",                  // Content (required)\n  \"altBody\"   =\u003e \"Plain text content\",             // Plain text version (optional)\n  \"fromEmail\" =\u003e \"sender@example.com\",            // Sender email (optional, defaults to configured account)\n  \"fromName\"  =\u003e \"Sender Name\",                   // Sender name (optional)\n  \"cc\"        =\u003e [\"cc@example.com\"],              // CC (optional)\n  \"bcc\"       =\u003e [\"bcc@example.com\"],             // BCC (optional)\n  \"priority\"  =\u003e \"high\",                          // Priority: high/normal/low (optional)\n  \"isHtml\"    =\u003e true                             // HTML format (optional, default false)\n]);\n```\n\n**Multiple Recipients**\n\n```php\n$config = [\n  \"email\" =\u003e [\n    \"user1@example.com\" =\u003e \"User One\",\n    \"user2@example.com\" =\u003e \"User Two\",\n    \"user3@example.com\"\n  ],\n  \"subject\" =\u003e \"Group Notification\",\n  \"body\"    =\u003e \"This is a group notification email\"\n];\n\n$result = Mailer::send($config);\n```\n\n**CC and BCC**\n\n```php\n$config = [\n  \"email\"   =\u003e \"primary@example.com\",\n  \"cc\"      =\u003e [\n    \"cc1@example.com\" =\u003e \"CC User One\",\n    \"cc2@example.com\"\n  ],\n  \"bcc\"     =\u003e [\n    \"bcc1@example.com\" =\u003e \"BCC User One\",\n    \"bcc2@example.com\"\n  ],\n  \"subject\" =\u003e \"Important Notice\",\n  \"body\"    =\u003e \"Email content\"\n];\n\n$result = Mailer::send($config);\n```\n\n### Bulk Sending\n\n**Mailer::sendBulk($recipients, $subject, $body, $options)** - Bulk email sending (static call)\n\n\u003e Note: Bulk sending automatically adds a random interval of 1-3 seconds between each email to avoid triggering rate limits from email providers like Gmail and iCloud.\n\n```php\n$results = Mailer::sendBulk(\n  [\n    \"user1@example.com\" =\u003e \"User One\",\n    \"user2@example.com\" =\u003e \"User Two\",\n    \"user3@example.com\" =\u003e \"User Three\"\n  ],\n  \"Bulk Notification Email\",\n  \"\u003ch1\u003eThis is a bulk sent email\u003c/h1\u003e\",\n  [\n    \"isHtml\"    =\u003e true,\n    \"priority\"  =\u003e \"normal\",\n    \"fromName\"  =\u003e \"System Administrator\"\n  ]\n);\n\n// Check sending results\nforeach ($results as $email =\u003e $success) {\n  if ($success) {\n    echo \"Successfully sent to {$email}\\n\";\n  } else {\n    echo \"Failed to send to {$email}\\n\";\n  }\n}\n```\n\n## Error Handling\n\n```php\ntry {\n  $mailer = new Mailer();\n  \n  $result = Mailer::send([\n    \"email\"   =\u003e \"test@example.com\",\n    \"subject\" =\u003e \"Test Email\",\n    \"body\"    =\u003e \"Test content\"\n  ]);\n  \n  if ($result) {\n    echo \"Email sent successfully\";\n  } else {\n    echo \"Email sending failed\";\n  }\n    \n} catch (\\Exception $e) {\n  error_log(\"Email sending error: \" . $e-\u003egetMessage());\n  \n  if (strpos($e-\u003egetMessage(), \"SMTP connect() failed\") !== false) {\n    echo \"SMTP connection failed, please check server settings\";\n  } elseif (strpos($e-\u003egetMessage(), \"Authentication\") !== false) {\n    echo \"SMTP authentication failed, please check username and password\";\n  } else {\n    echo \"Email sending exception: \" . $e-\u003egetMessage();\n  }\n}\n```\n\n### Connection Test\n\n```php\n// Test SMTP connection\ntry {\n  $mailer = new Mailer();\n  \n  // Send test email\n  $result = Mailer::send([\n      \"email\"   =\u003e \"test@example.com\",\n      \"subject\" =\u003e \"SMTP Connection Test\",\n      \"body\"    =\u003e \"If you receive this email, SMTP configuration is correct.\"\n  ]);\n  \n  echo $result ? \"SMTP configuration is correct\" : \"SMTP configuration error\";\n  \n} catch (\\Exception $e) {\n  echo \"SMTP test failed: \" . $e-\u003egetMessage();\n}\n```\n\n### Bulk Sending Monitoring\n\n```php\n$results = Mailer::sendBulk([\n    \"user1@example.com\" =\u003e \"User One\",\n    \"user2@example.com\" =\u003e \"User Two\",\n    \"user3@example.com\" =\u003e \"User Three\"\n], \"Notification\", \"Content\");\n\n$successCount = array_sum($results);\n$totalCount = count($results);\n$failureCount = $totalCount - $successCount;\n\necho \"Bulk sending completed - Success: {$successCount}, Failed: {$failureCount}, Total: {$totalCount}\";\n```\n\n## License\n\nThis source code project is licensed under [MIT](LICENSE).\n\n## Author\n\n\u003cimg src=\"https://avatars.githubusercontent.com/u/25631760\" align=\"left\" width=\"96\" height=\"96\" style=\"margin-right: 0.5rem;\"\u003e\n\n\u003ch4 style=\"padding-top: 0\"\u003e邱敬幃 Pardn Chiu\u003c/h4\u003e\n\n\u003ca href=\"mailto:dev@pardn.io\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://pardn.io/image/email.svg\" width=\"48\" height=\"48\"\u003e\n\u003c/a\u003e \u003ca href=\"https://linkedin.com/in/pardnchiu\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://pardn.io/image/linkedin.svg\" width=\"48\" height=\"48\"\u003e\n\u003c/a\u003e\n\n***\n\n©️ 2025 [邱敬幃 Pardn Chiu](https://pardn.io)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpardnio%2Fphp-mailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpardnio%2Fphp-mailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpardnio%2Fphp-mailer/lists"}