{"id":20321305,"url":"https://github.com/adrianorsouza/codeigniter-phpmailer","last_synced_at":"2025-10-13T16:17:36.434Z","repository":{"id":15690916,"uuid":"18428664","full_name":"adrianorsouza/codeigniter-phpmailer","owner":"adrianorsouza","description":"CodeIgniter mail plugin powered by PHPMailer library","archived":false,"fork":false,"pushed_at":"2020-05-28T15:55:29.000Z","size":23,"stargazers_count":10,"open_issues_count":1,"forks_count":13,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-27T09:43:26.167Z","etag":null,"topics":["codeigniter","codeigniter-mail","php","phpmailer","phpmailer-library"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"htw-inka/ocv_ar","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adrianorsouza.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":"2014-04-04T05:39:28.000Z","updated_at":"2023-06-27T10:14:51.000Z","dependencies_parsed_at":"2022-09-06T17:40:32.263Z","dependency_job_id":null,"html_url":"https://github.com/adrianorsouza/codeigniter-phpmailer","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/adrianorsouza/codeigniter-phpmailer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianorsouza%2Fcodeigniter-phpmailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianorsouza%2Fcodeigniter-phpmailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianorsouza%2Fcodeigniter-phpmailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianorsouza%2Fcodeigniter-phpmailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrianorsouza","download_url":"https://codeload.github.com/adrianorsouza/codeigniter-phpmailer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianorsouza%2Fcodeigniter-phpmailer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279016063,"owners_count":26085799,"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-10-13T02:00:06.723Z","response_time":61,"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":["codeigniter","codeigniter-mail","php","phpmailer","phpmailer-library"],"created_at":"2024-11-14T19:13:11.544Z","updated_at":"2025-10-13T16:17:36.406Z","avatar_url":"https://github.com/adrianorsouza.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Codeigniter mail plugin powered by PHPMailer\n============================================\n\n### A simple CodeIgniter mail class to connect your application through the powerful PHPMailer library.\n\n[![Latest Stable Version](https://poser.pugx.org/adrianorsouza/codeigniter-phpmailer/v/stable.svg)](https://packagist.org/packages/adrianorsouza/codeigniter-phpmailer) [![Total Downloads](https://poser.pugx.org/adrianorsouza/codeigniter-phpmailer/downloads.svg)](https://packagist.org/packages/adrianorsouza/codeigniter-phpmailer) [![Latest Unstable Version](https://poser.pugx.org/adrianorsouza/codeigniter-phpmailer/v/unstable.svg)](https://packagist.org/packages/adrianorsouza/codeigniter-phpmailer) [![License](https://poser.pugx.org/adrianorsouza/codeigniter-phpmailer/license.svg)](https://packagist.org/packages/adrianorsouza/codeigniter-phpmailer)\n\nTested over CodeIgniter v2.1.4 / v3.0-dev and PHPMailer Version 5.2.7\n\n## Install via Composer\n\n### To get this plugin via composer is the quick start.\n\nThis plugin utilizes Composer for its installation and PHPMailer dependency. If you haven't already, start by installing [Composer](http://getcomposer.org/doc/00-intro.md).\n\nAnd are available via [Composer/Packagist](https://packagist.org/packages/adrianorsouza/codeigniter-phpmailer). Once you have Composer configured in your environment run the command line:\n```CLI\n  $ composer require \"adrianorsouza/codeigniter-phpmailer:0.1.*\"\n```\nThis command will write into composer.json beyond download and place this project files and PHPMailer dependencies into your ``vendor`` folder.\n\nIf you have not included the composer autoload you must do it at the very top of your index.php page or whatever you are running this plugin.\n```PHP\nrequire_once __DIR__.'/vendor/autoload.php';\n```\nthat's all. Your able to send e-mail anywhere inside your CodeIgniter application.\n\nTo create an instance of `Mail()` class:\n```PHP\n $mail = new Mail();\n```\n\n## Alternatively manual installation\n\nIf you don't speak Composer, follow this instructions:\n\n- Download this zip files and uncompress it within of your `application/` directory.\n\n- Download [PHPMailer files](https://github.com/Synchro/PHPMailer) dependencies *because is not include in this package*.\n  - PHPMailerAutoload.php\n  - class.smtp.php\n  - class.phpmailer.php\n\nplace them into your `third_party` folder or `what/you/want` as long as you include PHPMailer autoloader where you call the class `Mail()`.\n\nTo load class `Mail()` use the same Codeigniter super-object:\n```PHP\n$this-\u003eload-\u003elibrary('mail');\n```\nThat's all.\n\n## Configuration\n\nAfter get this plugin you have to setup `mail_config.php` file that contains all mail server configuration that must be placed in your `application/config/` folder.\n\nIn order to be able to send emails from your local development either production server you must provide a valid SMTP account authentication.\n\nSo in this config file, you setup your smtp server and password, login, mail from and etc...\n\nTo set up a Gmail smtp account to send your emails, you must set the config `mail_smtp_secure` to `TLS`.\n\nTo send any message with a HTML template file place it into your views folder. The default folder is `views/templates/email` if you want to change it, set this in `mail_config.php` as long as it remains under views folder.\n\n### Sample mail_config.php\n```PHP\n\u003c?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');\n\n// Mailer Configuration\n$config['mail_mailer']          = 'PHPMailer';\n$config['mail_debug']           = 0; // default: 0, debugging: 2, 'local'\n$config['mail_debug_output']    = 'html';\n$config['mail_smtp_auth']       = true;\n$config['mail_smtp_secure']     = ''; // default: '' | tls | ssl |\n$config['mail_charset']         = 'utf-8';\n\n// Templates Path and optional config\n$config['mail_template_folder'] = 'templates/email';\n$config['mail_template_options'] = array(\n                                       'SITE_NAME' =\u003e 'Codeigniter Mail Plugin',\n                                       'SITE_LOGO' =\u003e 'http://localhost/images/logo.jpg',\n                                       'BASE_URL'  =\u003e 'http://localhost',\n                                    );\n// Server Configuration\n$config['mail_smtp']            = 'smtp.example.com';\n$config['mail_port']            = 587; // for gmail default 587 with tls\n$config['mail_user']            = 'someone@example.com';\n$config['mail_pass']            = 'secret';\n\n// Mailer config Sender/Receiver Addresses\n$config['mail_admin_mail']      = 'someone@example.com';\n$config['mail_admin_name']      = 'WebMaster';\n\n$config['mail_from_mail']       = 'someone@example.com';\n$config['mail_from_name']       = 'Site Name';\n\n$config['mail_replyto_mail']    = 'someone@example.com';\n$config['mail_replyto_name']    = 'Reply to Name';\n\n// BCC and CC Email Addresses\n$config['mail_bcc']             = 'someone@example.com';\n$config['mail_cc']              = 'someone@example.com';\n\n// BCC and CC enable config, default disabled;\n$config['mail_setBcc']          = false;\n$config['mail_setCc']           = false;\n\n\n/* End of file mail_config.php */\n/* Location: ./application/config/mail_config.php */\n\n```\n\n## Usage\n\n### Send a basic email message using a string as HTML body.\n```PHP\n$data = '\u003ch2\u003eSample Basic\u003c/h2\u003e\n         \u003chr\u003e\n         \u003cp\u003eThis is a simple basic mail message in \u003cstrong\u003eHTML\u003c/strong\u003e string format\u003c/p\u003e\n         \u003cp\u003eLorem ipsum dolor sit amharum\u003cbr /\u003e quod deserunt id dolores.\u003c/p\u003e';\n\n$mail = new Mail();\n$mail-\u003esetMailBody($data);\n$mail-\u003esendMail('Awesome Subject', 'someone@example.com');\n```\n\n### Send email message as an external HTML template\n```PHP\n$data = null;\n$template_html = 'sample-1.html'; //views/templates/mail/\n\n$mail = new Mail();\n$mail-\u003esetMailBody($data, $template_html);\n$mail-\u003esendMail('Awesome Subject', 'someone@example.com');\n```\n\n### Send email message as an associative array with external HTML template\nCreate a HTML template file and name it as `sample-2.html`.\n\n```HTML\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd style=\"width:640px; padding:20px;\"\u003e\n      \u003ch2\u003e\u003cimg src=\"{SITE_LOGO}\" width=\"49\" height=\"48\" alt=\"{SITE_NAME}\" /\u003e {SITE_NAME}\u003c/h2\u003e\n    \u003ch3\u003eHello {NAME}\u003c/h3\u003e\n      \u003ch3\u003eYour email address is: {EMAIL}\u003c/h3\u003e\n      \u003cp\u003e\n        {MESSAGE}\n      \u003c/p\u003e\n      \u003chr\u003e\n      \u003cspan\u003e\n        {DATE}\n      \u003c/span\u003e\n      \u003chr\u003e\n      \u003cp\u003e\n        {SMALL_TEXT}\n      \u003c/p\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n```\n\nThen set up a new mail message.\n```PHP\n$data = array(\n        \"NAME\"       =\u003e 'Juliet \u0026 Romeo',\n        \"EMAIL\"      =\u003e 'some_email@example.com',\n        \"MESSAGE\"    =\u003e 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.',\n        \"DATE\"       =\u003e date('Y-m-d H:i:s'),\n        \"SMALL_TEXT\" =\u003e 'Sapiente, fugiat consequatur illo eaque ipsam expedita sint itaque',\n        );\n\n$template_html = 'sample-2.html'; //views/templates/mail/\n\n$mail = new Mail();\n$mail-\u003esetMailBody($data, $template_html);\n$mail-\u003esendMail('Awesome Subject', 'someone@example.com');\n```\n\nMore examples you can find in file `Sample_controller.php` at `application/controllers` folder\n\nThis class is capable to send email message by passing an array as body content, external template HTML/TEXT file or as string.\n\nIf you don't pass an email address as a parameter `$to` to  `sendMail($Subject, $to);` methods by default `$to` will be defined with your config `mail_replyto_mail` value.\n\nYou can pass any config from the `mail_config.php` into class constructor as an array of values:\n```PHP\n$config = array(\n            'mail_bcc'=\u003e'my_email@example.com',\n            'mail_setBcc'=\u003etrue\n          );\n\n$mail = new Mail($config);\n```\nthis will enable BCC e send a copy as BCC to address my_email@example.com\n\n#### Notes\n1. If you are not in Composer instead of create new instance class ie: `$mail = new Mail();` just load class normally with:\n`$this-\u003eload-\u003elibrary('mail');` and use the super object `$this-\u003email-\u003esendMail();` instead.\n\n2. By default the PHPMailer sends email messages in HTML format and an alternative Plain-Text for those Mail Clients that do not support HTML.\nBut the plain-text content is by default extract from your HTML body and stripped to a text. Sometimes depending on your HTML structure the format of your plain text\ncan be unreadable, So if you want to have a specific template for text-plain format just create a .txt file of your HTML template as the same name\nending with .txt extension write it only text with your needs and the Mail plugin will find it and use its contents.\n\n2. Fell free to custom this plugin with your needs.\n\n### Bugs\nHave you found a bug? Please open a [new issue](https://github.com/adrianorsouza/codeigniter-phpmailer/issues).\n\n### Author\nAdriano Rosa\n  - https://adrianorosa.com\n\n### Further reading about PHPMailer\nhttps://github.com/Synchro/PHPMailer\n\n### Further reading about CodeIgniter\nhttp://ellislab.com/codeigniter\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianorsouza%2Fcodeigniter-phpmailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrianorsouza%2Fcodeigniter-phpmailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianorsouza%2Fcodeigniter-phpmailer/lists"}