Email package

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


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.

'always_load' => array(
	'packages' => array(

// Or in a controller:



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

Please note: The Email package loads the email config for you, so there is no need to autoload it.

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
The default setup to use if none is profided.
setups 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
The driver to use. Can be mail, smtp, sendmail, mailgun, mandrill or noop (only logs writes to log). Must be lowercase.
is_html boolean
Whether to send as html mail or as plain mail.
encode_headers boolean
Whether to encode subject and recipient names. Requires the mbstring extension.
charset string
The email message charset.
encoding string
The email message encoding. Can be 7bit, 8bit, quoted-printable and base64.
priority string
The email's priority. Can be:
  • \Email::P_LOWEST
  • \Email::P_LOW
  • \Email::P_NORMAL
  • \Email::P_HIGH
  • \Email::P_HIGHEST string|false
Use this to set a default from email address. string|false
Use this to set a default from name.
validate bool
Set to false if you don't want to validate the addresses. Can result in failure in sending.
auto_attach bool
Whether to auto attach (background) images from a html body.
generate_alt bool
Whether to automatically generate an alt body from a html body.
wordwrap int|false
Word wrap size. If lower than anything above 0 will wrap. This setting is ignored when using base64 or quoted-printable.
sendmail_path string
Path to sendmail. string
SMTP host.
smtp.port int
SMTP port.
smtp.username string
SMTP username.
smtp.password string
SMTP password.
smtp.timeout int
SMTP timeout. Increase this when a SMTP server times out during the sending proccess.
smtp.starttls bool
Whether a SMTP server needs STARTTLS command.
newline string
New line.
attach_paths 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
Use this to set a default return-path email address.
remove_html_comments bool
When true, all comments inside the HTML body will be stripped.
relative_protocol_replacement string|false
When set to a string, all relative protocol URI's (those starting with // instead of http://) will be replaced by the value you specify here. This allows you to convert them to http:// or https://, since some Email clients (Outlook!) do not support relative protocol URI's.
mandrill.key string
Your Mandrill API Key.
mandrill.message_options array
Check Mandrill docs. (Look for message struct)
mandrill.send_options.async bool
Enable a background sending mode
mandrill.send_options.ip_pool string
The name of the dedicated ip pool that should be used to send the message
mandrill.send_options.send_at string
When this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format.

Make sure to install mandrill/mandrill composer package if you want to use the mandrill driver.

Mailgun configuration

Param Type Default Description
key string
The key of your mailgun account.
domain string
The domain of your website