Follow given below steps:
Step 1
Download Mailchimp API File from: CodeIgniter-Library-for-MailChimp-API-v1.3.
Step 2
After then, Place MCAPI.php in given path: CodeIgniter\application\libraries- file name is MCAPI.php.
Step 3
Add mcapi.php in CodeIgniter\application\config
- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-
-
-
- $config['mcapi_apikey'] = '**********';
-
- $config['mcapi_secure'] = false;
Step 4
Add content in CodeIgniter\application\models - your usermodel.php(your file).
- $this->load->library('mcapi');
- $listID = '*********' ;
-
- $retval = $this->mcapi->listSubscribe($listID, $emailAddress);
-
- if ($this->mcapi->errorCode) {
- echo "Unable to subscribe email using listSubscribe()!";
- echo "\n\tCode=".$this->mcapi->errorCode;
- echo "\n\tMsg=".$this->mcapi->errorMessage."\n";
- }
- else {
- echo $emailAddress." added successfully\n";
- }