CodeIgniter Email Configuration

I was debugging an issue with sending email with PHP CodeIgniter and found this interesting. Strange enough the issue was not setting the charset.

Below setting worked for me

<?php defined('BASEPATH') OR exit('No direct script access allowed');

$config['protocol'] = 'smtp', // 'mail', 'sendmail', or 'smtp'
$config['smtp_host'] = 'smtp.example.com', 
$config['smtp_port'] = 465,
$config['smtp_user'] = 'no-reply@example.com',
$config['smtp_pass'] = '12345!',
$config['smtp_crypto'] = 'tls', //can be 'ssl' or 'tls' for example
$config['mailtype'] = 'text', //plaintext 'text' mails or 'html'
$config['smtp_timeout'] = '4', //in seconds
$config['charset'] = 'iso-8859-1',
$config['wordwrap'] = TRUE

On a side note, its interesting how to debug PHP application with VS Code and XDebug. If anyone interested this could be a great starting point ->

About buminda

buminda.com
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment