Mailjet has updated its Data & Privacy Policy, in accordance with european laws on cookies use. If you choose to pursue your browsing on our site, you explicitly agree that we may register cookies on your computer, for purposes of information collect and improvement of our services.


Mailjet and Codeigniter code sample

integration with Codeigniter's Email library

1) Configuration

Create a file in config/email.php and edit it :

$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://';
$config['smtp_port'] = '465';
$config['smtp_user'] = 'your_Mailjet_API_Key';
$config['smtp_pass'] = 'your_Mailjet_Secret_Key';
$config['charset'] = 'utf-8';
$config['mailtype'] = 'html';
$config['newline'] = "\r\n";

You have to edit only these configuration parameters :

- 'smtp_host' : ssl:// if you want use SSL secure mode, tls:// for TLS secure mode or for no encryption.
- 'smtp_port' : the port used to transport your emails (465, 587, 588, 25)
- 'smtp_user' : it's your API Key
- 'smtp_pass' : it's your Secret Key.

Others parameters must not be edited.

2) Use

In a controller :

$this->email->from('', 'You');
$this->email->subject('My first email by Mailjet');
$this->email->message('Hello from Mailjet & CodeIgniter !');

Do not forget to edit your sender address "from".

3) More