Mailhandler ignores .txt attachments. In MailhandlerPhpImapRetrieve.class.php in the function get_parts, this block of code:
// Handle Content-Disposition parameters for non-text types.
if ($structure->type != TYPETEXT && $structure->ifdparameters) {
foreach ($structure->dparameters as $parameter) {
switch (drupal_strtoupper($parameter->attribute)) {
case 'NAME':
case 'FILENAME':
$part->filename = $parameter->value;
break;
// put every thing else in the attributes array;
default:
$part->attributes[$parameter->attribute] = $parameter->value;
}
}
}
get skipped on .txt files. this means they never get named, and thus not saved (I believe). Retrieving the same file renamed with a different extension works fine. I'm not sure what the best fix is. I assume simply removing the condition will have unintended consequences.
The email was sent on linux using:
mutt -s "1bfdf" -a letter.txt -- admin-zEZ488f8zZ@mothership < letter2.txt
Here is my feed importer:
$feeds_importer = new stdClass;
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
$feeds_importer->id = 'feed_importer_2';
$feeds_importer->config = array(
'name' => 'Feed Importer 2',
'description' => 'Feed Importer 2',
'fetcher' => array(
'plugin_key' => 'MailhandlerFetcher',
'config' => array(
'filter' => 'MailhandlerFiltersNodes',
),
),
'parser' => array(
'plugin_key' => 'MailhandlerParser',
'config' => array(
'default_commands' => 'status: 1',
'commands_failed_auth' => 'status: 0',
'available_commands' => 'status',
'command_plugin' => array(
'MailhandlerCommandsHeaders' => 'MailhandlerCommandsHeaders',
'MailhandlerCommandsDefault' => 'MailhandlerCommandsDefault',
'MailhandlerCommandsFiles' => 'MailhandlerCommandsFiles',
),
'authenticate_plugin' => 'MailhandlerAuthenticateTokenauth',
),
),
'processor' => array(
'plugin_key' => 'FeedsNodeProcessor',
'config' => array(
'content_type' => 'story',
'input_format' => '0',
'update_existing' => '0',
'expire' => '-1',
'mappings' => array(
0 => array(
'source' => 'subject',
'target' => 'title',
'unique' => FALSE,
),
1 => array(
'source' => 'body_html',
'target' => 'body',
'unique' => FALSE,
),
2 => array(
'source' => 'authenticated_uid',
'target' => 'uid',
'unique' => FALSE,
),
3 => array(
'source' => 'date',
'target' => 'created',
'unique' => FALSE,
),
4 => array(
'source' => 'attachments',
'target' => 'attachment_field',
'unique' => FALSE,
),
5 => array(
'source' => 'udate',
'target' => 'created',
'unique' => FALSE,
),
),
'author' => 0,
'authorize' => 0,
),
),
'content_type' => 'mailhandler_source',
'update' => 0,
'import_period' => '0',
'expire_period' => 3600,
'import_on_create' => 1,
);
Comments
Comment #1
danepowell commentedThat doesn't sound right- I import .txt attachments all the time. Can you try the latest 6.x-2.x-dev and see if it helps?
Also, I see that you've mapped attachments to 'attachment_field'... that seems a bit odd, I would expect that field to be named 'field_attachment'.
Comment #2
matt v. commentedI'm seeing the same behavior; my .txt file attachments are being skipped. The target in my case is named 'field_attachment' though, as you would expect:
I tried updating to the latest 6.x-2.x-dev release and the .txt files continue to be skipped.
Comment #3
danepowell commentedWeird... okay, I will try to investigate. I don't have lots of time at the moment, so if you are able to contribute a patch I would appreciate it.
Comment #4
danepowell commentedI have just committed some changes that I think will help you. Please wait until tonight and then download 6.x-2.x-dev, and let me know if this is still a problem.
Comment #5
danepowell commented