Email package

The Email package provides an interface for sending email using either php's mail function, sendmail or SMTP. The package supports:

Installation

The Email package is part of the official download (since version 1.1). You will have to enable the package either in the app config or include it on the fly.

// Inside app/config/config.php under 'always_load'
'packages' => array(
	'email',
),

// Or in a controller:

\Package::load('email');

Configuration

Create (or copy from the package) a config file at app/config/email.php. And change the settings needed.

General configuration

Param Type Default Description
defaults array
array( /* default config array */ )
Default settings for every setup group to use. In your setup group you overwrite these values.
default_setup string
'default'
The default setup to use if none is profided.
setups array
array(
		'default' => array(),
	)
A setups array with one default setup. Add your own or modify the default setup group.

Group configuration

Param Type Default Description
useragent string
'FuelPHP, PHP 5.3 Framework'
The user agent.
driver string
'mail'
The driver to use. Can be mail, smtp or sendmail. Must be lowercase.
is_html boolean
false
Whether to send as html mail or as plain mail.
encode_headers boolean
true
Wether to encode subject and recipient names. Requires the mbstring extension.
charset string
'utf-8'
The email message charset.
encoding string
'8bit'
The email message encoding. Can be 7bit, 8bit, quoted-printable and base64.
priority string
\Email::P_NORMAL
The email's priority. Can be:
  • \Email::P_LOWEST
  • \Email::P_LOW
  • \Email::P_NORMAL
  • \Email::P_HIGH
  • \Email::P_HIGHEST
from.email string|false
false
Use this to set a default from email address.
from.name string|false
false
Use this to set a default from name.
validate bool
true
Set to false if you don't want to validate the addresses. Can result in failure in sending.
auto_attach bool
true
Whether to auto attach (background) images from a html body.
generate_alt bool
true
Whether to automatically generate an alt body from a html body.
wordwrap int|false
76
Word wrap size. If lower than anything above 0 will wrap. This setting is ignored when using base64 or quoted-printable.
sendmail_path string
'/usr/sbin/sendmail'
Path to sendmail.
smtp.host string
''
SMTP host.
smtp.port int
25
SMTP port.
smtp.username string
''
SMTP username.
smtp.password string
''
SMTP password.
smtp.timeout string
''
SMTP timeout. Increase this when a SMTP servers times out during the sending proccess.
newline string
"\n"
New line.
attach_paths array
array('');
Array of attachment paths. When adding attachments, the driver will look in these paths and attach the first on found. Leave the empty ('') in there to allow absolute paths.
return-path string|false
false
Use this to set a default return-path email address.