+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
!trim(file_get_contents($file))
) {
return CRM_Core_Error::createAPIError(ts('%1 does not exists or is empty',
- array(1 => $file)
- ));
+ array(1 => $file)
+ ));
}
require_once 'ezc/Base/src/ezc_bootstrap.php';
require_once 'ezc/autoload/mail_autoload.php';
// explode email to digestable format
- $set = new ezcMailFileSet(array($file));
+ $set = new ezcMailFileSet(array($file));
$parser = new ezcMailParser();
- $mail = $parser->parseMail($set);
+ $mail = $parser->parseMail($set);
if (!$mail) {
return CRM_Core_Error::createAPIError(ts('%1 could not be parsed',
- array(1 => $file)
- ));
+ array(1 => $file)
+ ));
}
// since we only have one fileset
// we definitely need a contact id for the from address
// if we dont have one, skip this email
if (empty($params['from']['id'])) {
- return;
+ return NULL;
}
$emailFields = array('to', 'cc', 'bcc');
$config = CRM_Core_Config::singleton();
for ($i = 0; $i < count($attachments); $i++) {
$attachNum = $i + 1;
- $fileName = basename($attachments[$i]['fullName']);
- $newName = CRM_Utils_File::makeFileName($fileName);
- $location = $config->uploadDir . $newName;
+ $fileName = basename($attachments[$i]['fullName']);
+ $newName = CRM_Utils_File::makeFileName($fileName);
+ $location = $config->uploadDir . $newName;
// move file to the civicrm upload directory
rename($attachments[$i]['fullName'], $location);
$subParam['email'] = $address->email;
$subParam['name'] = $address->name;
-
$contactID = self::getContactID($subParam['email'],
$subParam['name'],
TRUE,
}
/**
- * Retrieve a contact ID and if not present
+ * Retrieve a contact ID and if not present.
* create one with this email
*/
public static function getContactID($email, $name = NULL, $create = TRUE, &$mail) {
CRM_Core_DAO::$_nullArray
);
}
+
}