{"id":21467396,"url":"https://github.com/elusivecodes/fyremail","last_synced_at":"2025-07-15T05:31:20.657Z","repository":{"id":62508509,"uuid":"437861557","full_name":"elusivecodes/FyreMail","owner":"elusivecodes","description":"FyreMail is a free, open-source email library for PHP.","archived":false,"fork":false,"pushed_at":"2024-11-15T10:31:31.000Z","size":115,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-15T15:46:10.660Z","etag":null,"topics":["email","mail","php","sendmail","smtp"],"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/elusivecodes.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":"2021-12-13T12:19:59.000Z","updated_at":"2024-11-15T10:31:24.000Z","dependencies_parsed_at":"2024-05-12T05:23:58.744Z","dependency_job_id":"88d16ab1-10d5-4428-833e-05bac16c1a67","html_url":"https://github.com/elusivecodes/FyreMail","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreMail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreMail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreMail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreMail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elusivecodes","download_url":"https://codeload.github.com/elusivecodes/FyreMail/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226017457,"owners_count":17560514,"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","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","mail","php","sendmail","smtp"],"created_at":"2024-11-23T08:17:51.721Z","updated_at":"2025-07-15T05:31:20.634Z","avatar_url":"https://github.com/elusivecodes.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FyreMail\r\n\r\n**FyreMail** is a free, open-source email library for *PHP*.\r\n\r\n\r\n## Table Of Contents\r\n- [Installation](#installation)\r\n- [Basic Usage](#basic-usage)\r\n- [Methods](#methods)\r\n- [Mailers](#mailers)\r\n    - [Debug](#debug)\r\n    - [Sendmail](#sendmail)\r\n    - [SMTP](#smtp)\r\n- [Emails](#emails)\r\n\r\n\r\n\r\n## Installation\r\n\r\n**Using Composer**\r\n\r\n```\r\ncomposer require fyre/mail\r\n```\r\n\r\nIn PHP:\r\n\r\n```php\r\nuse Fyre\\Mail\\MailManager;\r\n```\r\n\r\n\r\n## Basic Usage\r\n\r\n- `$container` is a [*Container*](https://github.com/elusivecodes/FyreContainer).\r\n- `$config` is a [*Config*](https://github.com/elusivecodes/FyreConfig).\r\n\r\n```php\r\n$mailManager = new MailManager($container);\r\n```\r\n\r\nDefault configuration options will be resolved from the \"*Mail*\" key in the [*Config*](https://github.com/elusivecodes/FyreConfig).\r\n\r\n**Autoloading**\r\n\r\nIt is recommended to bind the *MailManager* to the [*Container*](https://github.com/elusivecodes/FyreContainer) as a singleton.\r\n\r\n```php\r\n$container-\u003esingleton(MailManager::class);\r\n```\r\n\r\nAny dependencies will be injected automatically when loading from the [*Container*](https://github.com/elusivecodes/FyreContainer).\r\n\r\n```php\r\n$mailManager = $container-\u003euse(MailManager::class);\r\n```\r\n\r\n\r\n## Methods\r\n\r\n**Build**\r\n\r\nBuild a [*Mailer*](#mailers).\r\n\r\n- `$options` is an array containing configuration options.\r\n\r\n```php\r\n$mailer = $mailManager-\u003ebuild($options);\r\n```\r\n\r\n[*Mailer*](#mailers) dependencies will be resolved automatically from the [*Container*](https://github.com/elusivecodes/FyreContainer).\r\n\r\n**Clear**\r\n\r\nClear all instances and configs.\r\n\r\n```php\r\n$mailManager-\u003eclear();\r\n```\r\n\r\n**Get Config**\r\n\r\nGet a [*Mailer*](#mailers) config.\r\n\r\n- `$key` is a string representing the [*Mailer*](#mailers) key.\r\n\r\n```php\r\n$config = $mailManager-\u003egetConfig($key);\r\n```\r\n\r\nAlternatively, if the `$key` argument is omitted an array containing all configurations will be returned.\r\n\r\n```php\r\n$config = $mailManager-\u003egetConfig();\r\n```\r\n\r\n**Has Config**\r\n\r\nDetermine whether a [*Mailer*](#mailers) config exists.\r\n\r\n- `$key` is a string representing the [*Mailer*](#mailers) key, and will default to `MailManager::DEFAULT`.\r\n\r\n```php\r\n$hasConfig = $mailManager-\u003ehasConfig($key);\r\n```\r\n\r\n**Is Loaded**\r\n\r\nDetermine whether a [*Mailer*](#mailers) instance is loaded.\r\n\r\n- `$key` is a string representing the [*Mailer*](#mailers) key, and will default to `MailManager::DEFAULT`.\r\n\r\n```php\r\n$isLoaded = $mailManager-\u003eisLoaded($key);\r\n```\r\n\r\n**Set Config**\r\n\r\nSet the [*Mailer*](#mailers) config.\r\n\r\n- `$key` is a string representing the [*Mailer*](#mailers) key.\r\n- `$options` is an array containing configuration options.\r\n\r\n```php\r\n$mailManager-\u003esetConfig($key, $options);\r\n```\r\n\r\n**Unload**\r\n\r\nUnload a [*Mailer*](#mailers).\r\n\r\n- `$key` is a string representing the [*Mailer*](#mailers) key, and will default to `MailManager::DEFAULT`.\r\n\r\n```php\r\n$unloaded = $mailManager-\u003eunload($key);\r\n```\r\n\r\n**Use**\r\n\r\nLoad a shared [*Mailer*](#mailers) instance.\r\n\r\n- `$key` is a string representing the [*Mailer*](#mailers) key, and will default to `MailManager::DEFAULT`.\r\n\r\n```php\r\n$mailer = $mailManager-\u003euse($key);\r\n```\r\n\r\n[*Mailer*](#mailers) dependencies will be resolved automatically from the [*Container*](https://github.com/elusivecodes/FyreContainer).\r\n\r\n\r\n## Mailers\r\n\r\nYou can load a specific mailer by specifying the `className` option of the `$options` variable above.\r\n\r\nCustom mailers can be created by extending `\\Fyre\\Mail\\Mailer`, ensuring all below methods are implemented.\r\n\r\n**Email**\r\n\r\nCreate an [*Email*](#emails).\r\n\r\n```php\r\n$email = $mailer-\u003eemail();\r\n```\r\n\r\n**Get Client**\r\n\r\nGet the client hostname.\r\n\r\n```php\r\n$client = $mailer-\u003egetCliet();\r\n```\r\n\r\n**Send**\r\n\r\nSend an [*Email*](#emails).\r\n\r\n- `$email` is an [*Email*](#emails).\r\n\r\n```php\r\n$mailer-\u003esend($email);\r\n```\r\n\r\n\r\n## Debug\r\n\r\nThe Debug mailer can be loaded using custom configuration.\r\n\r\n- `$key` is a string representing the mailer key.\r\n- `$options` is an array containing configuration options.\r\n    - `className` must be set to `\\Fyre\\Mail\\Handlers\\DebugMailer`.\r\n    - `charset` is a string representing the character set, and will default to \"*utf-8*\".\r\n    - `client` is a string representing the client hostname.\r\n\r\n```php\r\n$container-\u003euse(Config::class)-\u003eset('Mail.debug', $options);\r\n```\r\n\r\n**Clear**\r\n\r\nClear the sent emails.\r\n\r\n```php\r\n$mailer-\u003eclear();\r\n```\r\n\r\n**Get Sent Emails**\r\n\r\nGet the sent emails.\r\n\r\n```php\r\n$sentEmails = $mailer-\u003egetSentEmails();\r\n```\r\n\r\n\r\n### Sendmail\r\n\r\nThe Sendmail mailer can be loaded using custom configuration.\r\n\r\n- `$key` is a string representing the mailer key.\r\n- `$options` is an array containing configuration options.\r\n    - `className` must be set to `\\Fyre\\Mail\\Handlers\\SendmailMailer`.\r\n    - `charset` is a string representing the character set, and will default to \"*utf-8*\".\r\n    - `client` is a string representing the client hostname.\r\n\r\n```php\r\n$container-\u003euse(Config::class)-\u003eset('Mail.sendmail', $options);\r\n```\r\n\r\n\r\n### SMTP\r\n\r\nThe SMTP mailer can be loaded using custom configuration.\r\n\r\n- `$options` is an array containing configuration options.\r\n    - `className` must be set to `\\Fyre\\Mail\\Handlers\\SmtpMailer`.\r\n    - `host` is a string representing the SMTP host, and will default to \"*127.0.0.1*\".\r\n    - `username` is a string representing the SMTP username.\r\n    - `password` is a string representing the SMTP password.\r\n    - `port` is a number indicating the SMTP port, and will default to *465*.\r\n    - `auth` is a boolean indicating whether to authenticate, and will default to *false*.\r\n    - `tls` is a boolean indicating whether to use TLS encryption, and will default to *false*.\r\n    - `dsn` is a boolean indicating whether to use delivery status notification, and will default to *false*.\r\n    - `keepAlive` is a boolean indicating whether to use a persistent connection, and will default to *false*.\r\n    - `charset` is a string representing the character set, and will default to \"*utf-8*\".\r\n    - `client` is a string representing the client hostname.\r\n\r\n```php\r\n$container-\u003euse(Config::class)-\u003eset('Mail.smtp', $options);\r\n```\r\n\r\n\r\n## Emails\r\n\r\n**Add Attachments**\r\n\r\nAdd attachments.\r\n\r\n- `$attachments` is an array containing the attachments, where the key is the filename and the value is an array of attachment data.\r\n    - `file` is a string representing a path to a file.\r\n    - `content` is a string representing the file data.\r\n    - `mimeType` is a string representing the MIME content type.\r\n    - `contentId` is a string representing the content ID.\r\n    - `disposition` is a string representing the content disposition.\r\n\r\n```php\r\n$email-\u003eaddAttachments($attachments);\r\n```\r\n\r\nFor each attachment, a `file` or `content` must be supplied.\r\n\r\nIf the `mimeType` is omitted it will determined automatically from the file data.\r\n\r\nIf the `disposition` is omitted, it will default to \"*inline*\" if a `contentId` is provided, otherwise \"*attachment*\".\r\n\r\n**Add Bcc**\r\n\r\nAdd a bcc address.\r\n\r\n- `$email` is a string representing the email address.\r\n- `$name` is a string representing the name, and will default to the email address.\r\n\r\n```php\r\n$email-\u003eaddBcc($email, $name);\r\n```\r\n\r\n**Add Cc**\r\n\r\nAdd a cc address.\r\n\r\n- `$email` is a string representing the email address.\r\n- `$name` is a string representing the name, and will default to the email address.\r\n\r\n```php\r\n$email-\u003eaddCc($email, $name);\r\n```\r\n\r\n**Add Reply To**\r\n\r\nAdd a reply to address.\r\n\r\n- `$email` is a string representing the email address.\r\n- `$name` is a string representing the name, and will default to the email address.\r\n\r\n```php\r\n$email-\u003eaddReplyTo($email, $name);\r\n```\r\n\r\n**Add To**\r\n\r\nAdd a to address.\r\n\r\n- `$email` is a string representing the email address.\r\n- `$name` is a string representing the name, and will default to the email address.\r\n\r\n```php\r\n$email-\u003eaddTo($email, $name);\r\n```\r\n\r\n**Get Attachments**\r\n\r\nGet the attachments.\r\n\r\n```php\r\n$attachments = $email-\u003egetAttachments();\r\n```\r\n\r\n**Get Bcc**\r\n\r\nGet the bcc addresses.\r\n\r\n```php\r\n$bcc = $email-\u003egetBcc();\r\n```\r\n\r\n**Get Body HTML**\r\n\r\nGet the HTML body string.\r\n\r\n```php\r\n$html = $email-\u003egetBodyHtml();\r\n```\r\n\r\n**Get Body Text**\r\n\r\nGet the text body string.\r\n\r\n```php\r\n$text = $email-\u003egetBodyText();\r\n```\r\n\r\n**Get Boundary**\r\n\r\nGet the boundary.\r\n\r\n```php\r\n$boundary = $email-\u003egetBoundary();\r\n```\r\n\r\n**Get Cc**\r\n\r\nGet the cc addresses.\r\n\r\n```php\r\n$cc = $email-\u003egetCc();\r\n```\r\n\r\n**Get Charset**\r\n\r\nGet the character set.\r\n\r\n```php\r\n$charset = $email-\u003egetCharset();\r\n```\r\n\r\n**Get Format**\r\n\r\nGet the email format.\r\n\r\n```php\r\n$format = $email-\u003egetFormat();\r\n```\r\n\r\n**Get From**\r\n\r\nGet the from addresses.\r\n\r\n```php\r\n$from = $email-\u003egetFrom();\r\n```\r\n\r\n**Get Headers**\r\n\r\nGet the additional headers.\r\n\r\n```php\r\n$headers = $email-\u003egetHeaders();\r\n```\r\n\r\n**Get Message ID**\r\n\r\nGet the message ID.\r\n\r\n```php\r\n$messageId = $email-\u003egetMessageId();\r\n```\r\n\r\n**Get Priority**\r\n\r\nGet the priority.\r\n\r\n```php\r\n$priority = $email-\u003egetPriority();\r\n```\r\n\r\n**Get Read Receipt**\r\n\r\nGet the read recipient addresses.\r\n\r\n```php\r\n$readReceipt = $email-\u003egetReadReceipt();\r\n```\r\n\r\n**Get Recipients**\r\n\r\nGet the recipient addresses.\r\n\r\n```php\r\n$recipients = $email-\u003egetRecipients();\r\n```\r\n\r\n**Get Reply To**\r\n\r\nGet the reply to addresses.\r\n\r\n```php\r\n$replyTo = $email-\u003egetReplyTo();\r\n```\r\n\r\n**Get Return Path**\r\n\r\nGet the return path addresses.\r\n\r\n```php\r\n$returnPath = $email-\u003egetReturnPath();\r\n```\r\n\r\n**Get Sender**\r\n\r\nGet the sender addresses.\r\n\r\n```php\r\n$sender = $email-\u003egetSender();\r\n```\r\n\r\n**Get Subject**\r\n\r\nGet the subject.\r\n\r\n```php\r\n$subject = $email-\u003egetSubject();\r\n```\r\n\r\n**Get To**\r\n\r\nGet the to addresses.\r\n\r\n```php\r\n$to = $email-\u003egetTo();\r\n```\r\n\r\n**Send**\r\n\r\nSend the email.\r\n\r\n```php\r\n$email-\u003esend();\r\n```\r\n\r\n**Set Attachments**\r\n\r\nSet the attachments.\r\n\r\n- `$attachments` is an array containing the attachments, where the key is the filename and the value is an array of attachment data.\r\n    - `file` is a string representing a path to a file.\r\n    - `content` is a string representing the file data.\r\n    - `mimeType` is a string representing the MIME content type.\r\n    - `contentId` is a string representing the content ID.\r\n    - `disposition` is a string representing the content disposition.\r\n\r\n```php\r\n$email-\u003esetAttachments($attachments);\r\n```\r\n\r\nFor each attachment, a `file` or `content` must be supplied.\r\n\r\nIf the `mimeType` is omitted it will determined automatically from the file data.\r\n\r\nIf the `disposition` is omitted, it will default to \"*inline*\" if a `contentId` is provided, otherwise \"*attachment*\".\r\n\r\n**Set Bcc**\r\n\r\nSet the bcc addresses.\r\n\r\n- `$emails` is an array containing the email addresses, or key-value pairs of email addresses and names.\r\n\r\n```php\r\n$email-\u003esetBcc($emails);\r\n```\r\n\r\n**Set Body Html**\r\n\r\nSet the body HTML.\r\n\r\n- `$html` is a string representing the body HTML.\r\n\r\n```php\r\n$email-\u003esetBodyHtml($html);\r\n```\r\n\r\n**Set Body Text**\r\n\r\nSet the body text.\r\n\r\n- `$text` is a string representing the body text.\r\n\r\n```php\r\n$email-\u003esetBodyText($text);\r\n```\r\n\r\n**Set Cc**\r\n\r\nSet the cc addresses.\r\n\r\n- `$emails` is an array containing the email addresses, or key-value pairs of email addresses and names.\r\n\r\n```php\r\n$email-\u003esetCc($emails);\r\n```\r\n\r\n**Set Charset**\r\n\r\nSet the character set.\r\n\r\n- `$charset` is a string representing the character set.\r\n\r\n```php\r\n$email-\u003esetCharset($charset);\r\n```\r\n\r\n**Set Format**\r\n\r\nSet the email format.\r\n\r\n- `$format` is a string representing the email format, and must be one of either \"*html*\", \"*text*\", or \"*both*\".\r\n\r\n```php\r\n$email-\u003esetFormat($format);\r\n```\r\n\r\n**Set From**\r\n\r\nSet the from address.\r\n\r\n- `$email` is a string representing the email address.\r\n- `$name` is a string representing the name, and will default to the email address.\r\n\r\n```php\r\n$email-\u003esetFrom($email, $name);\r\n```\r\n\r\n**Set Headers**\r\n\r\nSet additional headers.\r\n\r\n- `$headers` is an array containing additional headers.\r\n\r\n```php\r\n$email-\u003esetHeaders($headers);\r\n```\r\n\r\n**Set Priority**\r\n\r\nSet the priority.\r\n\r\n```php\r\n$email-\u003esetPriority($priority);\r\n```\r\n\r\n**Set Read Receipt**\r\n\r\nSet the read recipient address.\r\n\r\n- `$email` is a string representing the email address.\r\n- `$name` is a string representing the name, and will default to the email address.\r\n\r\n```php\r\n$email-\u003esetReadReceipt($email, $name);\r\n```\r\n\r\n**Set Reply To**\r\n\r\nSet the reply to addresses.\r\n\r\n- `$emails` is an array containing the email addresses, or key-value pairs of email addresses and names.\r\n\r\n```php\r\n$email-\u003esetReplyTo($emails);\r\n```\r\n\r\n**Set Return Path**\r\n\r\nSet the return path address.\r\n\r\n- `$email` is a string representing the email address.\r\n- `$name` is a string representing the name, and will default to the email address.\r\n\r\n```php\r\n$email-\u003esetReturnPath($email, $name);\r\n```\r\n\r\n**Set Sender**\r\n\r\nSet the sender address.\r\n\r\n- `$email` is a string representing the email address.\r\n- `$name` is a string representing the name, and will default to the email address.\r\n\r\n```php\r\n$email-\u003esetSender($email, $name);\r\n```\r\n\r\n**Set Subject**\r\n\r\nSet the subject.\r\n\r\n- `$subject` is a string representing the subject.\r\n\r\n```php\r\n$email-\u003esetSubject($subject);\r\n```\r\n\r\n**Set To**\r\n\r\nSet the to addresses.\r\n\r\n- `$emails` is an array containing the email addresses, or key-value pairs of email addresses and names.\r\n\r\n```php\r\n$email-\u003esetTo($emails);\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felusivecodes%2Ffyremail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felusivecodes%2Ffyremail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felusivecodes%2Ffyremail/lists"}