blob: 0cca497f25508b5a10e5dd3820b9fd39feb62506 [file] [log] [blame]
Andrey Andreevc5769952019-01-16 17:49:35 +02001
2
3<!DOCTYPE html>
4<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
5<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
6<head>
7 <meta charset="utf-8">
8 <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
10 <title>Email Class &mdash; CodeIgniter 3.1.10 documentation</title>
11
12
13
14
15 <link rel="shortcut icon" href="../_static/ci-icon.ico"/>
16
17
18
19 <link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
20
21
22
23
24
25
26
27
28
29 <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" />
30
31
32
33 <link rel="index" title="Index"
34 href="../genindex.html"/>
35 <link rel="search" title="Search" href="../search.html"/>
36 <link rel="top" title="CodeIgniter 3.1.10 documentation" href="../index.html"/>
37 <link rel="up" title="Libraries" href="index.html"/>
38 <link rel="next" title="Encrypt Class" href="encrypt.html"/>
39 <link rel="prev" title="Config Class" href="config.html"/>
40
41
42 <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
43
44</head>
45
46<body class="wy-body-for-nav" role="document">
47
48 <div id="nav">
49 <div id="nav_inner">
50
51
52
53 <div id="pulldown-menu" class="ciNav">
54 <ul>
55<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li>
56</ul>
57<ul>
58<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul>
59<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li>
60<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li>
61<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li>
62<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li>
63</ul>
64</li>
65</ul>
66<ul>
67<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul>
68<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li>
69<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li>
70<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li>
71<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li>
72<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li>
73<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li>
74</ul>
75</li>
76</ul>
77<ul>
78<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul>
79<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li>
80<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li>
81<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li>
82<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li>
83</ul>
84</li>
85</ul>
86<ul>
87<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul>
88<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li>
89<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li>
90</ul>
91</li>
92</ul>
93<ul>
94<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul>
95<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li>
96<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li>
97<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li>
98<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li>
99<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li>
100<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li>
101<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li>
102<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li>
103<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li>
104<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li>
105<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li>
106<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li>
107<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li>
108<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li>
109<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li>
110<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li>
111<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li>
112<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li>
113<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li>
114<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li>
115<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li>
116<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li>
117<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li>
118<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li>
119<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li>
120<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li>
121</ul>
122</li>
123</ul>
124<ul class="current">
125<li class="toctree-l1 current"><a class="reference internal" href="index.html">Libraries</a><ul class="current">
126<li class="toctree-l2"><a class="reference internal" href="benchmark.html">Benchmarking Class</a></li>
127<li class="toctree-l2"><a class="reference internal" href="caching.html">Caching Driver</a></li>
128<li class="toctree-l2"><a class="reference internal" href="calendar.html">Calendaring Class</a></li>
129<li class="toctree-l2"><a class="reference internal" href="cart.html">Shopping Cart Class</a></li>
130<li class="toctree-l2"><a class="reference internal" href="config.html">Config Class</a></li>
131<li class="toctree-l2 current"><a class="current reference internal" href="#">Email Class</a></li>
132<li class="toctree-l2"><a class="reference internal" href="encrypt.html">Encrypt Class</a></li>
133<li class="toctree-l2"><a class="reference internal" href="encryption.html">Encryption Library</a></li>
134<li class="toctree-l2"><a class="reference internal" href="file_uploading.html">File Uploading Class</a></li>
135<li class="toctree-l2"><a class="reference internal" href="form_validation.html">Form Validation</a></li>
136<li class="toctree-l2"><a class="reference internal" href="ftp.html">FTP Class</a></li>
137<li class="toctree-l2"><a class="reference internal" href="image_lib.html">Image Manipulation Class</a></li>
138<li class="toctree-l2"><a class="reference internal" href="input.html">Input Class</a></li>
139<li class="toctree-l2"><a class="reference internal" href="javascript.html">Javascript Class</a></li>
140<li class="toctree-l2"><a class="reference internal" href="language.html">Language Class</a></li>
141<li class="toctree-l2"><a class="reference internal" href="loader.html">Loader Class</a></li>
142<li class="toctree-l2"><a class="reference internal" href="migration.html">Migrations Class</a></li>
143<li class="toctree-l2"><a class="reference internal" href="output.html">Output Class</a></li>
144<li class="toctree-l2"><a class="reference internal" href="pagination.html">Pagination Class</a></li>
145<li class="toctree-l2"><a class="reference internal" href="parser.html">Template Parser Class</a></li>
146<li class="toctree-l2"><a class="reference internal" href="security.html">Security Class</a></li>
147<li class="toctree-l2"><a class="reference internal" href="sessions.html">Session Library</a></li>
148<li class="toctree-l2"><a class="reference internal" href="table.html">HTML Table Class</a></li>
149<li class="toctree-l2"><a class="reference internal" href="trackback.html">Trackback Class</a></li>
150<li class="toctree-l2"><a class="reference internal" href="typography.html">Typography Class</a></li>
151<li class="toctree-l2"><a class="reference internal" href="unit_testing.html">Unit Testing Class</a></li>
152<li class="toctree-l2"><a class="reference internal" href="uri.html">URI Class</a></li>
153<li class="toctree-l2"><a class="reference internal" href="user_agent.html">User Agent Class</a></li>
154<li class="toctree-l2"><a class="reference internal" href="xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li>
155<li class="toctree-l2"><a class="reference internal" href="zip.html">Zip Encoding Class</a></li>
156</ul>
157</li>
158</ul>
159<ul>
160<li class="toctree-l1"><a class="reference internal" href="../database/index.html">Database Reference</a><ul>
161<li class="toctree-l2"><a class="reference internal" href="../database/examples.html">Quick Start: Usage Examples</a></li>
162<li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">Database Configuration</a></li>
163<li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">Connecting to a Database</a></li>
164<li class="toctree-l2"><a class="reference internal" href="../database/queries.html">Running Queries</a></li>
165<li class="toctree-l2"><a class="reference internal" href="../database/results.html">Generating Query Results</a></li>
166<li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">Query Helper Functions</a></li>
167<li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">Query Builder Class</a></li>
168<li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">Transactions</a></li>
169<li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">Getting MetaData</a></li>
170<li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">Custom Function Calls</a></li>
171<li class="toctree-l2"><a class="reference internal" href="../database/caching.html">Query Caching</a></li>
172<li class="toctree-l2"><a class="reference internal" href="../database/forge.html">Database Manipulation with Database Forge</a></li>
173<li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">Database Utilities Class</a></li>
174<li class="toctree-l2"><a class="reference internal" href="../database/db_driver_reference.html">Database Driver Reference</a></li>
175</ul>
176</li>
177</ul>
178<ul>
179<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul>
180<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li>
181<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li>
182<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li>
183<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li>
184<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li>
185<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li>
186<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li>
187<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li>
188<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li>
189<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li>
190<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li>
191<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li>
192<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li>
193<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li>
194<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li>
195<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li>
196<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li>
197<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li>
198<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li>
199<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li>
200<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li>
201</ul>
202</li>
203</ul>
204
205 </div>
206
207
208 </div>
209</div>
210<div id="nav2">
211 <a href="#" id="openToc">
212 <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBwYGCAoICQkJCQgKCgwMDAwMCgwMDQ0MDBERERERFBQUFBQUFBQUFAEEBQUIBwgPCgoPFA4ODhQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAKwCaAwERAAIRAQMRAf/EAHsAAQAABwEBAAAAAAAAAAAAAAABAwQFBgcIAgkBAQAAAAAAAAAAAAAAAAAAAAAQAAEDAwICBwYEAgsAAAAAAAIBAwQAEQUSBiEHkROTVNQWGDFBUVIUCHEiMtOUFWGBobHRQlMkZIRVEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwDSC+ygkOOaUoKigUCgUCgUCgUCgUCgUCgUCgkuGguIP9FBMFb0Hqg7We+3jlmIqqYFf4ub+/QYlnOR/LqIBKGFUbf8qWv971BytQXXE7Y3Lnm3HsFhp2TaZJAdchRXpIgSpdEJWxJEW3xoKV7F5OMy7JkQn2o7D6w33XGjEAkoiqrJEqIiOIiKuhePCgqp22dyYyS3CyWHnQ5joG61HkRnmnTbaFSMhExRVQRRVJU9iUHjE7ez+fJ0MFipmUNhBV8YUd2SoIV9KkjQla9ltegttBdPLW4/qocL+UTfrMiHW4+P9M71shuyrqaHTcxsl7jegpsji8nh5ZwMvDfgTm0RTjSmjYdFCS6KoOIipdFunCgmNYTMv457MMY6U7iI6oMieDDhRm1VbIhuoOkbqtuK0Hpzb+eZcYZexUxt6UyUqK2cd0SdjtgrhOgijcgERUlJOCIl6CpgbP3blRI8XgMjNARAyKNDfeRBdFDBVUAXgQrqH4pxoJTu2NysY97LP4ac1io5q1InHFeGO24LnVKJuKOkSQ/yKir+rh7aCLG1dzypZQI2FnvTgccYOM3FeN0XWERXAUEFVQgQkUktdLpegm+Td3/Xli/L+S/mYNJIOF9G/wBeLKrZHFb0akG6W1WtQWSg3Dyg5e7V3fipE3O4/wCrktyzYA+ufas2LbZIlmnAT2kvuoN1wft95augilglX/tzP3qCu9O3LL/wV/i5v79BvmTADq14UGu91467Z6U9y0HzH/ncj/U/sT/CgynZG7I2NezpZGUjIycJkYkZSG+uQ81pbBNKLxJfjwoMqZ3/ALYHl35AJ7/cuwHcu5k7r1Q5pHetBjquqVVJWGxj9Zrtcl/Ggy3dHMvauR3HFZj5nHNxSyW5JISYDMoIwx8tFIGHZhPNaykGapr6rUAiicEoMG21lMRj8buPAz8xhJrr7uOeiPTCyAwXUaGR1mgozbTusOsFLEiJ7fbQa/h7gcjy2H3V6xppwDNtUSxCJIqp7valBuWVzJ22xuCROXNNZiJkMtms0DbjUkAZjzoDrTMd9dDRI44ZC2YsrYdKWP2WDT2S3N9dNdlRYrGMYc06IURXSYb0igrpWS485xVNS6nF4rwslkoMwnbpgZLB7bmt5uMweAhDEl4B5uSLzzqTnnyVpW2jaJHRMSIjdDiiotvy3DOE5rYTEbkl5yFn28k7JyG4c7AU2HtLH1uKfaiMPI40CdYbpNtmLdwTSn5rewLNld+7TLdeal4WarWBkbVKBjgdElMJJwAAY5fl4kB3b1fp4XvagsGS3FjJfLzDNtS8aeXx7LzT7TyzByQE5PccRGRC0ZRUDRV6y62vbjagzLmJzS2vuPK43JY6aP1TW6Jz+RIWyFtyC06y3EkiiinAo7YCqfq1AqqnGgsOH3lhZO8d1pmcpB8j5XIm9OYlBJSQ/FSS4427DKO0RC8AlcEMhFdViRR1WDWR5t3WXVuL1d106kG9vdeye2g60+1FDyW0shIcXVpyroXt8I8dfd+NB1vioAdWnD3UF1+gD4UFc6CEKpagxXN43rwJLUHz7yX2c8zokt9uHlsPIhA4aRnnHJTLptIS6CNsY7iASpxUUMkReGpfbQW0vtN5pitvrsN28rwtBD0nc0+/Yft5XhaB6TuaXfsP28rwtA9J3NPv2H7eV4Wgek7mn37D9vK8LQPSdzT79h+3leFoHpO5pd+w/byvC0D0nc0u/Yft5XhaB6TuaXfsP28rwtA9J3NLv2H7eV4Wgek7ml37D9vK8LQPSdzS79h+3leFoHpO5p9+w/byvC0E9r7Reazy2HIYVPxkS/CUHVn26cosxyv2g7h89LYmZSXOenvLEQ1YaQ222RATcQCP8rSGqqA8S02W2pQ6FhMoAIlqCtsnwoCpdKClejI4i3Sgtb+GBxVuNBSFt1pV/RQefLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8utJ/koJ7WCbBU/LQXOPAFq1koK8B0pag90CggtBBf6qB0UDooHRQOigdFA6KB0UDooHRQOigdFA6KB0UDooI0EaBQf//Z" title="Toggle Table of Contents" alt="Toggle Table of Contents" />
213 </a>
214</div>
215
216 <div class="wy-grid-for-nav">
217
218
219 <nav data-toggle="wy-nav-shift" class="wy-nav-side">
220 <div class="wy-side-nav-search">
221
222 <a href="../index.html" class="fa fa-home"> CodeIgniter</a>
223
224
225<div role="search">
226 <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
227 <input type="text" name="q" placeholder="Search docs" />
228 <input type="hidden" name="check_keywords" value="yes" />
229 <input type="hidden" name="area" value="default" />
230 </form>
231</div>
232 </div>
233
234 <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
235
236
237
238 <ul>
239<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li>
240</ul>
241<ul>
242<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul>
243<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li>
244<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li>
245<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li>
246<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li>
247</ul>
248</li>
249</ul>
250<ul>
251<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul>
252<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li>
253<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li>
254<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li>
255<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li>
256<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li>
257<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li>
258</ul>
259</li>
260</ul>
261<ul>
262<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul>
263<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li>
264<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li>
265<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li>
266<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li>
267</ul>
268</li>
269</ul>
270<ul>
271<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul>
272<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li>
273<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li>
274</ul>
275</li>
276</ul>
277<ul>
278<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul>
279<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li>
280<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li>
281<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li>
282<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li>
283<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li>
284<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li>
285<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li>
286<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li>
287<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li>
288<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li>
289<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li>
290<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li>
291<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li>
292<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li>
293<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li>
294<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li>
295<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li>
296<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li>
297<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li>
298<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li>
299<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li>
300<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li>
301<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li>
302<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li>
303<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li>
304<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li>
305</ul>
306</li>
307</ul>
308<ul class="current">
309<li class="toctree-l1 current"><a class="reference internal" href="index.html">Libraries</a><ul class="current">
310<li class="toctree-l2"><a class="reference internal" href="benchmark.html">Benchmarking Class</a></li>
311<li class="toctree-l2"><a class="reference internal" href="caching.html">Caching Driver</a></li>
312<li class="toctree-l2"><a class="reference internal" href="calendar.html">Calendaring Class</a></li>
313<li class="toctree-l2"><a class="reference internal" href="cart.html">Shopping Cart Class</a></li>
314<li class="toctree-l2"><a class="reference internal" href="config.html">Config Class</a></li>
315<li class="toctree-l2 current"><a class="current reference internal" href="#">Email Class</a></li>
316<li class="toctree-l2"><a class="reference internal" href="encrypt.html">Encrypt Class</a></li>
317<li class="toctree-l2"><a class="reference internal" href="encryption.html">Encryption Library</a></li>
318<li class="toctree-l2"><a class="reference internal" href="file_uploading.html">File Uploading Class</a></li>
319<li class="toctree-l2"><a class="reference internal" href="form_validation.html">Form Validation</a></li>
320<li class="toctree-l2"><a class="reference internal" href="ftp.html">FTP Class</a></li>
321<li class="toctree-l2"><a class="reference internal" href="image_lib.html">Image Manipulation Class</a></li>
322<li class="toctree-l2"><a class="reference internal" href="input.html">Input Class</a></li>
323<li class="toctree-l2"><a class="reference internal" href="javascript.html">Javascript Class</a></li>
324<li class="toctree-l2"><a class="reference internal" href="language.html">Language Class</a></li>
325<li class="toctree-l2"><a class="reference internal" href="loader.html">Loader Class</a></li>
326<li class="toctree-l2"><a class="reference internal" href="migration.html">Migrations Class</a></li>
327<li class="toctree-l2"><a class="reference internal" href="output.html">Output Class</a></li>
328<li class="toctree-l2"><a class="reference internal" href="pagination.html">Pagination Class</a></li>
329<li class="toctree-l2"><a class="reference internal" href="parser.html">Template Parser Class</a></li>
330<li class="toctree-l2"><a class="reference internal" href="security.html">Security Class</a></li>
331<li class="toctree-l2"><a class="reference internal" href="sessions.html">Session Library</a></li>
332<li class="toctree-l2"><a class="reference internal" href="table.html">HTML Table Class</a></li>
333<li class="toctree-l2"><a class="reference internal" href="trackback.html">Trackback Class</a></li>
334<li class="toctree-l2"><a class="reference internal" href="typography.html">Typography Class</a></li>
335<li class="toctree-l2"><a class="reference internal" href="unit_testing.html">Unit Testing Class</a></li>
336<li class="toctree-l2"><a class="reference internal" href="uri.html">URI Class</a></li>
337<li class="toctree-l2"><a class="reference internal" href="user_agent.html">User Agent Class</a></li>
338<li class="toctree-l2"><a class="reference internal" href="xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li>
339<li class="toctree-l2"><a class="reference internal" href="zip.html">Zip Encoding Class</a></li>
340</ul>
341</li>
342</ul>
343<ul>
344<li class="toctree-l1"><a class="reference internal" href="../database/index.html">Database Reference</a><ul>
345<li class="toctree-l2"><a class="reference internal" href="../database/examples.html">Quick Start: Usage Examples</a></li>
346<li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">Database Configuration</a></li>
347<li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">Connecting to a Database</a></li>
348<li class="toctree-l2"><a class="reference internal" href="../database/queries.html">Running Queries</a></li>
349<li class="toctree-l2"><a class="reference internal" href="../database/results.html">Generating Query Results</a></li>
350<li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">Query Helper Functions</a></li>
351<li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">Query Builder Class</a></li>
352<li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">Transactions</a></li>
353<li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">Getting MetaData</a></li>
354<li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">Custom Function Calls</a></li>
355<li class="toctree-l2"><a class="reference internal" href="../database/caching.html">Query Caching</a></li>
356<li class="toctree-l2"><a class="reference internal" href="../database/forge.html">Database Manipulation with Database Forge</a></li>
357<li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">Database Utilities Class</a></li>
358<li class="toctree-l2"><a class="reference internal" href="../database/db_driver_reference.html">Database Driver Reference</a></li>
359</ul>
360</li>
361</ul>
362<ul>
363<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul>
364<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li>
365<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li>
366<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li>
367<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li>
368<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li>
369<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li>
370<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li>
371<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li>
372<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li>
373<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li>
374<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li>
375<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li>
376<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li>
377<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li>
378<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li>
379<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li>
380<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li>
381<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li>
382<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li>
383<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li>
384<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li>
385</ul>
386</li>
387</ul>
388
389
390
391 </div>
392 &nbsp;
393 </nav>
394
395 <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
396
397
398 <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
399 <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
400 <a href="../index.html">CodeIgniter</a>
401 </nav>
402
403
404
405 <div class="wy-nav-content">
406 <div class="rst-content">
407 <div role="navigation" aria-label="breadcrumbs navigation">
408 <ul class="wy-breadcrumbs">
409 <li><a href="../index.html">Docs</a> &raquo;</li>
410
411 <li><a href="index.html">Libraries</a> &raquo;</li>
412
413 <li>Email Class</li>
414 <li class="wy-breadcrumbs-aside">
415
416 </li>
417 <div style="float:right;margin-left:5px;" id="closeMe">
418 <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" />
419 </div>
420 </ul>
421 <hr/>
422</div>
423 <div role="main" class="document">
424
425 <div class="section" id="email-class">
426<h1>Email Class<a class="headerlink" href="#email-class" title="Permalink to this headline"></a></h1>
427<p>CodeIgniter’s robust Email Class supports the following features:</p>
428<ul class="simple">
429<li>Multiple Protocols: Mail, Sendmail, and SMTP</li>
430<li>TLS and SSL Encryption for SMTP</li>
431<li>Multiple recipients</li>
432<li>CC and BCCs</li>
433<li>HTML or Plaintext email</li>
434<li>Attachments</li>
435<li>Word wrapping</li>
436<li>Priorities</li>
437<li>BCC Batch Mode, enabling large email lists to be broken into small
438BCC batches.</li>
439<li>Email Debugging tools</li>
440</ul>
441<div class="contents local topic" id="contents">
442<ul class="simple">
443<li><a class="reference internal" href="#using-the-email-library" id="id1">Using the Email Library</a><ul>
444<li><a class="reference internal" href="#sending-email" id="id2">Sending Email</a></li>
445<li><a class="reference internal" href="#setting-email-preferences" id="id3">Setting Email Preferences</a><ul>
446<li><a class="reference internal" href="#setting-email-preferences-in-a-config-file" id="id4">Setting Email Preferences in a Config File</a></li>
447</ul>
448</li>
449<li><a class="reference internal" href="#email-preferences" id="id5">Email Preferences</a></li>
450<li><a class="reference internal" href="#overriding-word-wrapping" id="id6">Overriding Word Wrapping</a></li>
451</ul>
452</li>
453<li><a class="reference internal" href="#class-reference" id="id7">Class Reference</a></li>
454</ul>
455</div>
456<div class="custom-index container"></div><div class="section" id="using-the-email-library">
457<h2><a class="toc-backref" href="#id1">Using the Email Library</a><a class="headerlink" href="#using-the-email-library" title="Permalink to this headline"></a></h2>
458<div class="section" id="sending-email">
459<h3><a class="toc-backref" href="#id2">Sending Email</a><a class="headerlink" href="#sending-email" title="Permalink to this headline"></a></h3>
460<p>Sending email is not only simple, but you can configure it on the fly or
461set your preferences in a config file.</p>
462<p>Here is a basic example demonstrating how you might send email. Note:
463This example assumes you are sending the email from one of your
464<a class="reference internal" href="../general/controllers.html"><span class="doc">controllers</span></a>.</p>
465<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;email&#39;</span><span class="p">);</span>
466
467<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">from</span><span class="p">(</span><span class="s1">&#39;your@example.com&#39;</span><span class="p">,</span> <span class="s1">&#39;Your Name&#39;</span><span class="p">);</span>
468<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">to</span><span class="p">(</span><span class="s1">&#39;someone@example.com&#39;</span><span class="p">);</span>
469<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">cc</span><span class="p">(</span><span class="s1">&#39;another@another-example.com&#39;</span><span class="p">);</span>
470<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">bcc</span><span class="p">(</span><span class="s1">&#39;them@their-example.com&#39;</span><span class="p">);</span>
471
472<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">subject</span><span class="p">(</span><span class="s1">&#39;Email Test&#39;</span><span class="p">);</span>
473<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">message</span><span class="p">(</span><span class="s1">&#39;Testing the email class.&#39;</span><span class="p">);</span>
474
475<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">();</span>
476</pre></div>
477</div>
478</div>
479<div class="section" id="setting-email-preferences">
480<h3><a class="toc-backref" href="#id3">Setting Email Preferences</a><a class="headerlink" href="#setting-email-preferences" title="Permalink to this headline"></a></h3>
481<p>There are 21 different preferences available to tailor how your email
482messages are sent. You can either set them manually as described here,
483or automatically via preferences stored in your config file, described
484below:</p>
485<p>Preferences are set by passing an array of preference values to the
486email initialize method. Here is an example of how you might set some
487preferences:</p>
488<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$config</span><span class="p">[</span><span class="s1">&#39;protocol&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;sendmail&#39;</span><span class="p">;</span>
489<span class="nv">$config</span><span class="p">[</span><span class="s1">&#39;mailpath&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;/usr/sbin/sendmail&#39;</span><span class="p">;</span>
490<span class="nv">$config</span><span class="p">[</span><span class="s1">&#39;charset&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;iso-8859-1&#39;</span><span class="p">;</span>
491<span class="nv">$config</span><span class="p">[</span><span class="s1">&#39;wordwrap&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="k">TRUE</span><span class="p">;</span>
492
493<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">initialize</span><span class="p">(</span><span class="nv">$config</span><span class="p">);</span>
494</pre></div>
495</div>
496<div class="admonition note">
497<p class="first admonition-title">Note</p>
498<p class="last">Most of the preferences have default values that will be used
499if you do not set them.</p>
500</div>
501<div class="section" id="setting-email-preferences-in-a-config-file">
502<h4><a class="toc-backref" href="#id4">Setting Email Preferences in a Config File</a><a class="headerlink" href="#setting-email-preferences-in-a-config-file" title="Permalink to this headline"></a></h4>
503<p>If you prefer not to set preferences using the above method, you can
504instead put them into a config file. Simply create a new file called the
505email.php, add the $config array in that file. Then save the file at
506config/email.php and it will be used automatically. You will NOT need to
507use the <code class="docutils literal"><span class="pre">$this-&gt;email-&gt;initialize()</span></code> method if you save your
508preferences in a config file.</p>
509</div>
510</div>
511<div class="section" id="email-preferences">
512<h3><a class="toc-backref" href="#id5">Email Preferences</a><a class="headerlink" href="#email-preferences" title="Permalink to this headline"></a></h3>
513<p>The following is a list of all the preferences that can be set when
514sending email.</p>
515<table border="1" class="docutils">
516<colgroup>
517<col width="14%" />
518<col width="16%" />
519<col width="20%" />
520<col width="51%" />
521</colgroup>
522<thead valign="bottom">
523<tr class="row-odd"><th class="head">Preference</th>
524<th class="head">Default Value</th>
525<th class="head">Options</th>
526<th class="head">Description</th>
527</tr>
528</thead>
529<tbody valign="top">
530<tr class="row-even"><td><strong>useragent</strong></td>
531<td>CodeIgniter</td>
532<td>None</td>
533<td>The “user agent”.</td>
534</tr>
535<tr class="row-odd"><td><strong>protocol</strong></td>
536<td>mail</td>
537<td>mail, sendmail, or smtp</td>
538<td>The mail sending protocol.</td>
539</tr>
540<tr class="row-even"><td><strong>mailpath</strong></td>
541<td>/usr/sbin/sendmail</td>
542<td>None</td>
543<td>The server path to Sendmail.</td>
544</tr>
545<tr class="row-odd"><td><strong>smtp_host</strong></td>
546<td>No Default</td>
547<td>None</td>
548<td>SMTP Server Address.</td>
549</tr>
550<tr class="row-even"><td><strong>smtp_user</strong></td>
551<td>No Default</td>
552<td>None</td>
553<td>SMTP Username.</td>
554</tr>
555<tr class="row-odd"><td><strong>smtp_pass</strong></td>
556<td>No Default</td>
557<td>None</td>
558<td>SMTP Password.</td>
559</tr>
560<tr class="row-even"><td><strong>smtp_port</strong></td>
561<td>25</td>
562<td>None</td>
563<td>SMTP Port.</td>
564</tr>
565<tr class="row-odd"><td><strong>smtp_timeout</strong></td>
566<td>5</td>
567<td>None</td>
568<td>SMTP Timeout (in seconds).</td>
569</tr>
570<tr class="row-even"><td><strong>smtp_keepalive</strong></td>
571<td>FALSE</td>
572<td>TRUE or FALSE (boolean)</td>
573<td>Enable persistent SMTP connections.</td>
574</tr>
575<tr class="row-odd"><td><strong>smtp_crypto</strong></td>
576<td>No Default</td>
577<td>tls or ssl</td>
578<td>SMTP Encryption</td>
579</tr>
580<tr class="row-even"><td><strong>wordwrap</strong></td>
581<td>TRUE</td>
582<td>TRUE or FALSE (boolean)</td>
583<td>Enable word-wrap.</td>
584</tr>
585<tr class="row-odd"><td><strong>wrapchars</strong></td>
586<td>76</td>
587<td>&#160;</td>
588<td>Character count to wrap at.</td>
589</tr>
590<tr class="row-even"><td><strong>mailtype</strong></td>
591<td>text</td>
592<td>text or html</td>
593<td>Type of mail. If you send HTML email you must send it as a complete web
594page. Make sure you don’t have any relative links or relative image
595paths otherwise they will not work.</td>
596</tr>
597<tr class="row-odd"><td><strong>charset</strong></td>
598<td><code class="docutils literal"><span class="pre">$config['charset']</span></code></td>
599<td>&#160;</td>
600<td>Character set (utf-8, iso-8859-1, etc.).</td>
601</tr>
602<tr class="row-even"><td><strong>validate</strong></td>
603<td>FALSE</td>
604<td>TRUE or FALSE (boolean)</td>
605<td>Whether to validate the email address.</td>
606</tr>
607<tr class="row-odd"><td><strong>priority</strong></td>
608<td>3</td>
609<td>1, 2, 3, 4, 5</td>
610<td>Email Priority. 1 = highest. 5 = lowest. 3 = normal.</td>
611</tr>
612<tr class="row-even"><td><strong>crlf</strong></td>
613<td>\n</td>
614<td>“\r\n” or “\n” or “\r”</td>
615<td>Newline character. (Use “\r\n” to comply with RFC 822).</td>
616</tr>
617<tr class="row-odd"><td><strong>newline</strong></td>
618<td>\n</td>
619<td>“\r\n” or “\n” or “\r”</td>
620<td>Newline character. (Use “\r\n” to comply with RFC 822).</td>
621</tr>
622<tr class="row-even"><td><strong>bcc_batch_mode</strong></td>
623<td>FALSE</td>
624<td>TRUE or FALSE (boolean)</td>
625<td>Enable BCC Batch Mode.</td>
626</tr>
627<tr class="row-odd"><td><strong>bcc_batch_size</strong></td>
628<td>200</td>
629<td>None</td>
630<td>Number of emails in each BCC batch.</td>
631</tr>
632<tr class="row-even"><td><strong>dsn</strong></td>
633<td>FALSE</td>
634<td>TRUE or FALSE (boolean)</td>
635<td>Enable notify message from server</td>
636</tr>
637</tbody>
638</table>
639</div>
640<div class="section" id="overriding-word-wrapping">
641<h3><a class="toc-backref" href="#id6">Overriding Word Wrapping</a><a class="headerlink" href="#overriding-word-wrapping" title="Permalink to this headline"></a></h3>
642<p>If you have word wrapping enabled (recommended to comply with RFC 822)
643and you have a very long link in your email it can get wrapped too,
644causing it to become un-clickable by the person receiving it.
645CodeIgniter lets you manually override word wrapping within part of your
646message like this:</p>
647<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nx">The</span> <span class="nx">text</span> <span class="nx">of</span> <span class="nx">your</span> <span class="nx">email</span> <span class="nx">that</span>
648<span class="nx">gets</span> <span class="nx">wrapped</span> <span class="nx">normally</span><span class="o">.</span>
649
650<span class="p">{</span><span class="nx">unwrap</span><span class="p">}</span><span class="nx">http</span><span class="o">://</span><span class="nx">example</span><span class="o">.</span><span class="nx">com</span><span class="o">/</span><span class="nx">a_long_link_that_should_not_be_wrapped</span><span class="o">.</span><span class="nx">html</span><span class="p">{</span><span class="o">/</span><span class="nx">unwrap</span><span class="p">}</span>
651
652<span class="nx">More</span> <span class="nx">text</span> <span class="nx">that</span> <span class="nx">will</span> <span class="nx">be</span>
653<span class="nx">wrapped</span> <span class="nx">normally</span><span class="o">.</span>
654</pre></div>
655</div>
656<p>Place the item you do not want word-wrapped between: {unwrap} {/unwrap}</p>
657</div>
658</div>
659<div class="section" id="class-reference">
660<h2><a class="toc-backref" href="#id7">Class Reference</a><a class="headerlink" href="#class-reference" title="Permalink to this headline"></a></h2>
661<dl class="class">
662<dt id="CI_Email">
663<em class="property">class </em><code class="descname">CI_Email</code><a class="headerlink" href="#CI_Email" title="Permalink to this definition"></a></dt>
664<dd><dl class="method">
665<dt id="CI_Email::from">
666<code class="descname">from</code><span class="sig-paren">(</span><em>$from</em><span class="optional">[</span>, <em>$name = ''</em><span class="optional">[</span>, <em>$return_path = NULL</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Email::from" title="Permalink to this definition"></a></dt>
667<dd><table class="docutils field-list" frame="void" rules="none">
668<col class="field-name" />
669<col class="field-body" />
670<tbody valign="top">
671<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
672<li><strong>$from</strong> (<em>string</em>) – “From” e-mail address</li>
673<li><strong>$name</strong> (<em>string</em>) – “From” display name</li>
674<li><strong>$return_path</strong> (<em>string</em>) – Optional email address to redirect undelivered e-mail to</li>
675</ul>
676</td>
677</tr>
678<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Email instance (method chaining)</p>
679</td>
680</tr>
681<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Email</p>
682</td>
683</tr>
684</tbody>
685</table>
686<p>Sets the email address and name of the person sending the email:</p>
687<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">from</span><span class="p">(</span><span class="s1">&#39;you@example.com&#39;</span><span class="p">,</span> <span class="s1">&#39;Your Name&#39;</span><span class="p">);</span>
688</pre></div>
689</div>
690<p>You can also set a Return-Path, to help redirect undelivered mail:</p>
691<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">from</span><span class="p">(</span><span class="s1">&#39;you@example.com&#39;</span><span class="p">,</span> <span class="s1">&#39;Your Name&#39;</span><span class="p">,</span> <span class="s1">&#39;returned_emails@example.com&#39;</span><span class="p">);</span>
692</pre></div>
693</div>
694<div class="admonition note">
695<p class="first admonition-title">Note</p>
696<p class="last">Return-Path can’t be used if you’ve configured ‘smtp’ as
697your protocol.</p>
698</div>
699</dd></dl>
700
701<dl class="method">
702<dt id="CI_Email::reply_to">
703<code class="descname">reply_to</code><span class="sig-paren">(</span><em>$replyto</em><span class="optional">[</span>, <em>$name = ''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Email::reply_to" title="Permalink to this definition"></a></dt>
704<dd><table class="docutils field-list" frame="void" rules="none">
705<col class="field-name" />
706<col class="field-body" />
707<tbody valign="top">
708<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
709<li><strong>$replyto</strong> (<em>string</em>) – E-mail address for replies</li>
710<li><strong>$name</strong> (<em>string</em>) – Display name for the reply-to e-mail address</li>
711</ul>
712</td>
713</tr>
714<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Email instance (method chaining)</p>
715</td>
716</tr>
717<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Email</p>
718</td>
719</tr>
720</tbody>
721</table>
722<p>Sets the reply-to address. If the information is not provided the
723information in the :meth:from method is used. Example:</p>
724<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">reply_to</span><span class="p">(</span><span class="s1">&#39;you@example.com&#39;</span><span class="p">,</span> <span class="s1">&#39;Your Name&#39;</span><span class="p">);</span>
725</pre></div>
726</div>
727</dd></dl>
728
729<dl class="method">
730<dt id="CI_Email::to">
731<code class="descname">to</code><span class="sig-paren">(</span><em>$to</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_Email::to" title="Permalink to this definition"></a></dt>
732<dd><table class="docutils field-list" frame="void" rules="none">
733<col class="field-name" />
734<col class="field-body" />
735<tbody valign="top">
736<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
737<li><strong>$to</strong> (<em>mixed</em>) – Comma-delimited string or an array of e-mail addresses</li>
738</ul>
739</td>
740</tr>
741<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Email instance (method chaining)</p>
742</td>
743</tr>
744<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Email</p>
745</td>
746</tr>
747</tbody>
748</table>
749<p>Sets the email address(s) of the recipient(s). Can be a single e-mail,
750a comma-delimited list or an array:</p>
751<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">to</span><span class="p">(</span><span class="s1">&#39;someone@example.com&#39;</span><span class="p">);</span>
752</pre></div>
753</div>
754<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">to</span><span class="p">(</span><span class="s1">&#39;one@example.com, two@example.com, three@example.com&#39;</span><span class="p">);</span>
755</pre></div>
756</div>
757<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">to</span><span class="p">(</span>
758 <span class="k">array</span><span class="p">(</span><span class="s1">&#39;one@example.com&#39;</span><span class="p">,</span> <span class="s1">&#39;two@example.com&#39;</span><span class="p">,</span> <span class="s1">&#39;three@example.com&#39;</span><span class="p">)</span>
759<span class="p">);</span>
760</pre></div>
761</div>
762</dd></dl>
763
764<dl class="method">
765<dt id="CI_Email::cc">
766<code class="descname">cc</code><span class="sig-paren">(</span><em>$cc</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_Email::cc" title="Permalink to this definition"></a></dt>
767<dd><table class="docutils field-list" frame="void" rules="none">
768<col class="field-name" />
769<col class="field-body" />
770<tbody valign="top">
771<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
772<li><strong>$cc</strong> (<em>mixed</em>) – Comma-delimited string or an array of e-mail addresses</li>
773</ul>
774</td>
775</tr>
776<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Email instance (method chaining)</p>
777</td>
778</tr>
779<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Email</p>
780</td>
781</tr>
782</tbody>
783</table>
784<p>Sets the CC email address(s). Just like the “to”, can be a single e-mail,
785a comma-delimited list or an array.</p>
786</dd></dl>
787
788<dl class="method">
789<dt id="CI_Email::bcc">
790<code class="descname">bcc</code><span class="sig-paren">(</span><em>$bcc</em><span class="optional">[</span>, <em>$limit = ''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Email::bcc" title="Permalink to this definition"></a></dt>
791<dd><table class="docutils field-list" frame="void" rules="none">
792<col class="field-name" />
793<col class="field-body" />
794<tbody valign="top">
795<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
796<li><strong>$bcc</strong> (<em>mixed</em>) – Comma-delimited string or an array of e-mail addresses</li>
797<li><strong>$limit</strong> (<em>int</em>) – Maximum number of e-mails to send per batch</li>
798</ul>
799</td>
800</tr>
801<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Email instance (method chaining)</p>
802</td>
803</tr>
804<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Email</p>
805</td>
806</tr>
807</tbody>
808</table>
809<p>Sets the BCC email address(s). Just like the <code class="docutils literal"><span class="pre">to()</span></code> method, can be a single
810e-mail, a comma-delimited list or an array.</p>
811<p>If <code class="docutils literal"><span class="pre">$limit</span></code> is set, “batch mode” will be enabled, which will send
812the emails to batches, with each batch not exceeding the specified
813<code class="docutils literal"><span class="pre">$limit</span></code>.</p>
814</dd></dl>
815
816<dl class="method">
817<dt id="CI_Email::subject">
818<code class="descname">subject</code><span class="sig-paren">(</span><em>$subject</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_Email::subject" title="Permalink to this definition"></a></dt>
819<dd><table class="docutils field-list" frame="void" rules="none">
820<col class="field-name" />
821<col class="field-body" />
822<tbody valign="top">
823<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
824<li><strong>$subject</strong> (<em>string</em>) – E-mail subject line</li>
825</ul>
826</td>
827</tr>
828<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Email instance (method chaining)</p>
829</td>
830</tr>
831<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Email</p>
832</td>
833</tr>
834</tbody>
835</table>
836<p>Sets the email subject:</p>
837<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">subject</span><span class="p">(</span><span class="s1">&#39;This is my subject&#39;</span><span class="p">);</span>
838</pre></div>
839</div>
840</dd></dl>
841
842<dl class="method">
843<dt id="CI_Email::message">
844<code class="descname">message</code><span class="sig-paren">(</span><em>$body</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_Email::message" title="Permalink to this definition"></a></dt>
845<dd><table class="docutils field-list" frame="void" rules="none">
846<col class="field-name" />
847<col class="field-body" />
848<tbody valign="top">
849<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
850<li><strong>$body</strong> (<em>string</em>) – E-mail message body</li>
851</ul>
852</td>
853</tr>
854<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Email instance (method chaining)</p>
855</td>
856</tr>
857<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Email</p>
858</td>
859</tr>
860</tbody>
861</table>
862<p>Sets the e-mail message body:</p>
863<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">message</span><span class="p">(</span><span class="s1">&#39;This is my message&#39;</span><span class="p">);</span>
864</pre></div>
865</div>
866</dd></dl>
867
868<dl class="method">
869<dt id="CI_Email::set_alt_message">
870<code class="descname">set_alt_message</code><span class="sig-paren">(</span><em>$str</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_Email::set_alt_message" title="Permalink to this definition"></a></dt>
871<dd><table class="docutils field-list" frame="void" rules="none">
872<col class="field-name" />
873<col class="field-body" />
874<tbody valign="top">
875<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
876<li><strong>$str</strong> (<em>string</em>) – Alternative e-mail message body</li>
877</ul>
878</td>
879</tr>
880<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Email instance (method chaining)</p>
881</td>
882</tr>
883<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Email</p>
884</td>
885</tr>
886</tbody>
887</table>
888<p>Sets the alternative e-mail message body:</p>
889<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">set_alt_message</span><span class="p">(</span><span class="s1">&#39;This is the alternative message&#39;</span><span class="p">);</span>
890</pre></div>
891</div>
892<p>This is an optional message string which can be used if you send
893HTML formatted email. It lets you specify an alternative message
894with no HTML formatting which is added to the header string for
895people who do not accept HTML email. If you do not set your own
896message CodeIgniter will extract the message from your HTML email
897and strip the tags.</p>
898</dd></dl>
899
900<dl class="method">
901<dt id="CI_Email::set_header">
902<code class="descname">set_header</code><span class="sig-paren">(</span><em>$header</em>, <em>$value</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_Email::set_header" title="Permalink to this definition"></a></dt>
903<dd><table class="docutils field-list" frame="void" rules="none">
904<col class="field-name" />
905<col class="field-body" />
906<tbody valign="top">
907<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
908<li><strong>$header</strong> (<em>string</em>) – Header name</li>
909<li><strong>$value</strong> (<em>string</em>) – Header value</li>
910</ul>
911</td>
912</tr>
913<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Email instance (method chaining)</p>
914</td>
915</tr>
916<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Email</p>
917</td>
918</tr>
919</tbody>
920</table>
921<p>Appends additional headers to the e-mail:</p>
922<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">set_header</span><span class="p">(</span><span class="s1">&#39;Header1&#39;</span><span class="p">,</span> <span class="s1">&#39;Value1&#39;</span><span class="p">);</span>
923<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">set_header</span><span class="p">(</span><span class="s1">&#39;Header2&#39;</span><span class="p">,</span> <span class="s1">&#39;Value2&#39;</span><span class="p">);</span>
924</pre></div>
925</div>
926</dd></dl>
927
928<dl class="method">
929<dt id="CI_Email::clear">
930<code class="descname">clear</code><span class="sig-paren">(</span><span class="optional">[</span><em>$clear_attachments = FALSE</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Email::clear" title="Permalink to this definition"></a></dt>
931<dd><table class="docutils field-list" frame="void" rules="none">
932<col class="field-name" />
933<col class="field-body" />
934<tbody valign="top">
935<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
936<li><strong>$clear_attachments</strong> (<em>bool</em>) – Whether or not to clear attachments</li>
937</ul>
938</td>
939</tr>
940<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Email instance (method chaining)</p>
941</td>
942</tr>
943<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Email</p>
944</td>
945</tr>
946</tbody>
947</table>
948<p>Initializes all the email variables to an empty state. This method
949is intended for use if you run the email sending method in a loop,
950permitting the data to be reset between cycles.</p>
951<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">foreach</span> <span class="p">(</span><span class="nv">$list</span> <span class="k">as</span> <span class="nv">$name</span> <span class="o">=&gt;</span> <span class="nv">$address</span><span class="p">)</span>
952<span class="p">{</span>
953 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">clear</span><span class="p">();</span>
954
955 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">to</span><span class="p">(</span><span class="nv">$address</span><span class="p">);</span>
956 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">from</span><span class="p">(</span><span class="s1">&#39;your@example.com&#39;</span><span class="p">);</span>
957 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">subject</span><span class="p">(</span><span class="s1">&#39;Here is your info &#39;</span><span class="o">.</span><span class="nv">$name</span><span class="p">);</span>
958 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">message</span><span class="p">(</span><span class="s1">&#39;Hi &#39;</span><span class="o">.</span><span class="nv">$name</span><span class="o">.</span><span class="s1">&#39; Here is the info you requested.&#39;</span><span class="p">);</span>
959 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">();</span>
960<span class="p">}</span>
961</pre></div>
962</div>
963<p>If you set the parameter to TRUE any attachments will be cleared as
964well:</p>
965<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">clear</span><span class="p">(</span><span class="k">TRUE</span><span class="p">);</span>
966</pre></div>
967</div>
968</dd></dl>
969
970<dl class="method">
971<dt id="CI_Email::send">
972<code class="descname">send</code><span class="sig-paren">(</span><span class="optional">[</span><em>$auto_clear = TRUE</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Email::send" title="Permalink to this definition"></a></dt>
973<dd><table class="docutils field-list" frame="void" rules="none">
974<col class="field-name" />
975<col class="field-body" />
976<tbody valign="top">
977<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
978<li><strong>$auto_clear</strong> (<em>bool</em>) – Whether to clear message data automatically</li>
979</ul>
980</td>
981</tr>
982<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">TRUE on success, FALSE on failure</p>
983</td>
984</tr>
985<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
986</td>
987</tr>
988</tbody>
989</table>
990<p>The e-mail sending method. Returns boolean TRUE or FALSE based on
991success or failure, enabling it to be used conditionally:</p>
992<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="p">(</span> <span class="o">!</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">())</span>
993<span class="p">{</span>
994 <span class="c1">// Generate error</span>
995<span class="p">}</span>
996</pre></div>
997</div>
998<p>This method will automatically clear all parameters if the request was
999successful. To stop this behaviour pass FALSE:</p>
1000<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">if</span> <span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="k">FALSE</span><span class="p">))</span>
1001<span class="p">{</span>
1002 <span class="c1">// Parameters won&#39;t be cleared</span>
1003<span class="p">}</span>
1004</pre></div>
1005</div>
1006<div class="admonition note">
1007<p class="first admonition-title">Note</p>
1008<p class="last">In order to use the <code class="docutils literal"><span class="pre">print_debugger()</span></code> method, you need
1009to avoid clearing the email parameters.</p>
1010</div>
1011</dd></dl>
1012
1013<dl class="method">
1014<dt id="CI_Email::attach">
1015<code class="descname">attach</code><span class="sig-paren">(</span><em>$filename</em><span class="optional">[</span>, <em>$disposition = ''</em><span class="optional">[</span>, <em>$newname = NULL</em><span class="optional">[</span>, <em>$mime = ''</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Email::attach" title="Permalink to this definition"></a></dt>
1016<dd><table class="docutils field-list" frame="void" rules="none">
1017<col class="field-name" />
1018<col class="field-body" />
1019<tbody valign="top">
1020<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1021<li><strong>$filename</strong> (<em>string</em>) – File name</li>
1022<li><strong>$disposition</strong> (<em>string</em>) – ‘disposition’ of the attachment. Most
1023email clients make their own decision regardless of the MIME
1024specification used here. <a class="reference external" href="https://www.iana.org/assignments/cont-disp/cont-disp.xhtml">https://www.iana.org/assignments/cont-disp/cont-disp.xhtml</a></li>
1025<li><strong>$newname</strong> (<em>string</em>) – Custom file name to use in the e-mail</li>
1026<li><strong>$mime</strong> (<em>string</em>) – MIME type to use (useful for buffered data)</li>
1027</ul>
1028</td>
1029</tr>
1030<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">CI_Email instance (method chaining)</p>
1031</td>
1032</tr>
1033<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">CI_Email</p>
1034</td>
1035</tr>
1036</tbody>
1037</table>
1038<p>Enables you to send an attachment. Put the file path/name in the first
1039parameter. For multiple attachments use the method multiple times.
1040For example:</p>
1041<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">attach</span><span class="p">(</span><span class="s1">&#39;/path/to/photo1.jpg&#39;</span><span class="p">);</span>
1042<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">attach</span><span class="p">(</span><span class="s1">&#39;/path/to/photo2.jpg&#39;</span><span class="p">);</span>
1043<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">attach</span><span class="p">(</span><span class="s1">&#39;/path/to/photo3.jpg&#39;</span><span class="p">);</span>
1044</pre></div>
1045</div>
1046<p>To use the default disposition (attachment), leave the second parameter blank,
1047otherwise use a custom disposition:</p>
1048<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">attach</span><span class="p">(</span><span class="s1">&#39;image.jpg&#39;</span><span class="p">,</span> <span class="s1">&#39;inline&#39;</span><span class="p">);</span>
1049</pre></div>
1050</div>
1051<p>You can also use a URL:</p>
1052<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">attach</span><span class="p">(</span><span class="s1">&#39;http://example.com/filename.pdf&#39;</span><span class="p">);</span>
1053</pre></div>
1054</div>
1055<p>If you’d like to use a custom file name, you can use the third parameter:</p>
1056<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">attach</span><span class="p">(</span><span class="s1">&#39;filename.pdf&#39;</span><span class="p">,</span> <span class="s1">&#39;attachment&#39;</span><span class="p">,</span> <span class="s1">&#39;report.pdf&#39;</span><span class="p">);</span>
1057</pre></div>
1058</div>
1059<p>If you need to use a buffer string instead of a real - physical - file you can
1060use the first parameter as buffer, the third parameter as file name and the fourth
1061parameter as mime-type:</p>
1062<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">attach</span><span class="p">(</span><span class="nv">$buffer</span><span class="p">,</span> <span class="s1">&#39;attachment&#39;</span><span class="p">,</span> <span class="s1">&#39;report.pdf&#39;</span><span class="p">,</span> <span class="s1">&#39;application/pdf&#39;</span><span class="p">);</span>
1063</pre></div>
1064</div>
1065</dd></dl>
1066
1067<dl class="method">
1068<dt id="CI_Email::attachment_cid">
1069<code class="descname">attachment_cid</code><span class="sig-paren">(</span><em>$filename</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_Email::attachment_cid" title="Permalink to this definition"></a></dt>
1070<dd><table class="docutils field-list" frame="void" rules="none">
1071<col class="field-name" />
1072<col class="field-body" />
1073<tbody valign="top">
1074<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1075<li><strong>$filename</strong> (<em>string</em>) – Existing attachment filename</li>
1076</ul>
1077</td>
1078</tr>
1079<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Attachment Content-ID or FALSE if not found</p>
1080</td>
1081</tr>
1082<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
1083</td>
1084</tr>
1085</tbody>
1086</table>
1087<p>Sets and returns an attachment’s Content-ID, which enables your to embed an inline
1088(picture) attachment into HTML. First parameter must be the already attached file name.</p>
1089<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$filename</span> <span class="o">=</span> <span class="s1">&#39;/img/photo1.jpg&#39;</span><span class="p">;</span>
1090<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">attach</span><span class="p">(</span><span class="nv">$filename</span><span class="p">);</span>
1091<span class="k">foreach</span> <span class="p">(</span><span class="nv">$list</span> <span class="k">as</span> <span class="nv">$address</span><span class="p">)</span>
1092<span class="p">{</span>
1093 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">to</span><span class="p">(</span><span class="nv">$address</span><span class="p">);</span>
1094 <span class="nv">$cid</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">attachment_cid</span><span class="p">(</span><span class="nv">$filename</span><span class="p">);</span>
1095 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">message</span><span class="p">(</span><span class="s1">&#39;&lt;img src=&quot;cid:&#39;</span><span class="o">.</span> <span class="nv">$cid</span> <span class="o">.</span><span class="s1">&#39;&quot; alt=&quot;photo1&quot; /&gt;&#39;</span><span class="p">);</span>
1096 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">();</span>
1097<span class="p">}</span>
1098</pre></div>
1099</div>
1100<div class="admonition note">
1101<p class="first admonition-title">Note</p>
1102<p class="last">Content-ID for each e-mail must be re-created for it to be unique.</p>
1103</div>
1104</dd></dl>
1105
1106<dl class="method">
1107<dt id="CI_Email::print_debugger">
1108<code class="descname">print_debugger</code><span class="sig-paren">(</span><span class="optional">[</span><em>$include = array('headers'</em>, <em>'subject'</em>, <em>'body')</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Email::print_debugger" title="Permalink to this definition"></a></dt>
1109<dd><table class="docutils field-list" frame="void" rules="none">
1110<col class="field-name" />
1111<col class="field-body" />
1112<tbody valign="top">
1113<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1114<li><strong>$include</strong> (<em>array</em>) – Which parts of the message to print out</li>
1115</ul>
1116</td>
1117</tr>
1118<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Formatted debug data</p>
1119</td>
1120</tr>
1121<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
1122</td>
1123</tr>
1124</tbody>
1125</table>
1126<p>Returns a string containing any server messages, the email headers, and
1127the email message. Useful for debugging.</p>
1128<p>You can optionally specify which parts of the message should be printed.
1129Valid options are: <strong>headers</strong>, <strong>subject</strong>, <strong>body</strong>.</p>
1130<p>Example:</p>
1131<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="c1">// You need to pass FALSE while sending in order for the email data</span>
1132<span class="c1">// to not be cleared - if that happens, print_debugger() would have</span>
1133<span class="c1">// nothing to output.</span>
1134<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="k">FALSE</span><span class="p">);</span>
1135
1136<span class="c1">// Will only print the email headers, excluding the message subject and body</span>
1137<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">email</span><span class="o">-&gt;</span><span class="na">print_debugger</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="s1">&#39;headers&#39;</span><span class="p">));</span>
1138</pre></div>
1139</div>
1140<div class="admonition note">
1141<p class="first admonition-title">Note</p>
1142<p class="last">By default, all of the raw data will be printed.</p>
1143</div>
1144</dd></dl>
1145
1146</dd></dl>
1147
1148</div>
1149</div>
1150
1151
1152 </div>
1153 <footer>
1154
1155 <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
1156
1157 <a href="encrypt.html" class="btn btn-neutral float-right" title="Encrypt Class">Next <span class="fa fa-arrow-circle-right"></span></a>
1158
1159
1160 <a href="config.html" class="btn btn-neutral" title="Config Class"><span class="fa fa-arrow-circle-left"></span> Previous</a>
1161
1162 </div>
1163
1164
1165 <hr/>
1166
1167 <div role="contentinfo">
1168 <p>
1169 &copy; Copyright 2014 - 2019, British Columbia Institute of Technology.
1170 Last updated on Jan 16, 2019.
1171 </p>
1172 </div>
1173
1174 Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
1175
1176</footer>
1177 </div>
1178 </div>
1179
1180 </section>
1181
1182 </div>
1183
1184
1185
1186
1187
1188 <script type="text/javascript">
1189 var DOCUMENTATION_OPTIONS = {
1190 URL_ROOT:'../',
1191 VERSION:'3.1.10',
1192 COLLAPSE_INDEX:false,
1193 FILE_SUFFIX:'.html',
1194 HAS_SOURCE: false
1195 };
1196 </script>
1197 <script type="text/javascript" src="../_static/jquery.js"></script>
1198 <script type="text/javascript" src="../_static/underscore.js"></script>
1199 <script type="text/javascript" src="../_static/doctools.js"></script>
1200
1201
1202
1203
1204
1205 <script type="text/javascript" src="../_static/js/theme.js"></script>
1206
1207
1208
1209
1210 <script type="text/javascript">
1211 jQuery(function () {
1212 SphinxRtdTheme.StickyNav.enable();
1213 });
1214 </script>
1215
1216
1217</body>
1218</html>