How to configure SMTP account for emails?

The generated website in the demo deployment uses our SMTP account for sending email notifications from the website. But when you are downloading the generated website our SMTP account details are removed for security reason. You need to configure the downloaded website with your own SMTP account details.

All the configuration files are located in the application/config folder for CodeIgniter websites. The configuration file for email SMTP configuration is the file "thephpcode.com.php". So please open the file in any text editor and look for the setting with key email_config for updating the details for the SMTP configurations. For example, if you are using your Gmail account for sending emails then the setting will look like below.

$config['email_config'] = array(
                      "protocol" => 'smtp',
                      "smtp_host" => 'smtp.gmail.com',
                      "smtp_user" => 'your-username@gmail.com',
                      "smtp_pass" => 'your-password',
                      "smtp_port" => 587,
                      "smtp_timeout" => 120,
                      "charset" => 'iso-8859-1',
                      'mailtype' => 'html',
                      'wordwrap' => TRUE
                     );

You can create an email account in your website control panel (mostly cpanel) and use it here. You can look for SMTP configurations details over there in help.

Back to academy home