download mail plugin - Multiple email accounts

By Daryl - January 6, 2014 - edited: January 6, 2014

Hi Maurice,

Yes, it is possible to download mails from multiple email accounts by adding a new block of downloadMail_addAccount array for the other email accounts in downloadMail/downloadMail.php. For example:

// Example Gmail account - Download messages from inbox then archive them under "All Mail"
downloadMail_addAccount(array(
  'account'  => 'my-email@example.com', // account name, displayed in CMS
  'type'     => 'POP3',              // account type: POP3 or IMAP

  'username' => 'my-email@example.com', // or example@yourdomain.com for Google Apps
  'password' => 'myemailpass',
  'hostname' => 'pop.gmail.com',

  'archive'  => '', // IMAP Only, move messages to this folder instead of deleting them
  'secure'   => true,  // whether the host requires a secure connection: true or false (no quotes)
  'port'     => '',    // (optional) port number (if non-standard)
  'limit'    => '10',   // (optional) max messages to download at a time (set low to avoid server timeouts)
  'testmode' => true, // (optional) don't archive or erase messages after downloading them
));
// add another email account details
downloadMail_addAccount(array(
  'account'  => 'other-email@example.com', // account name, displayed in CMS
  'type'     => 'POP3',              // account type: POP3 or IMAP

  'username' => 'other-email@example.com', // or example@yourdomain.com for Google Apps
  'password' => 'otheremailpass',
  'hostname' => 'pop.gmail.com',

  'archive'  => '', // IMAP Only, move messages to this folder instead of deleting them
  'secure'   => true,  // whether the host requires a secure connection: true or false (no quotes)
  'port'     => '',    // (optional) port number (if non-standard)
  'limit'    => '10',   // (optional) max messages to download at a time (set low to avoid server timeouts)
  'testmode' => true, // (optional) don't archive or erase messages after downloading them
));

However, saving the downloaded mails to different sections will require some customization of the plugin.

What I would do is, first, make a full back up. Then I will set up the sections where I want the emails to be saved and update the line of code where the plugin saves the emails. You can find that code in downloadMail.php and search for downloadMail_addRecord() function where you can find the SQL statement for saving the email data. Change the table name to the table name of the section  that I want to put the email data into and make sure that the field names matches the one in the sql statement.

Hope this helps!

Cheers,

Daryl Maximo
PHP Programmer - interactivetools.com