[email_attachments]

Description

Link: [email_attachments]
Author: Jason Huck
Category: Email
Version: 8.5.x
License: Public Domain
Posted: Aug. 02, 2007
Updated: Jan. 01, 0001
More by this author...
Returns an array of email attachment data for the given message. Follows the example from the Language Guide with the addition of also including message parts with a content-disposition of "inline." Each item in the array is a map containing the raw message data, the filename, the file's MIME type, and the size.

Parameters

none


Sample Usage

var('attachments') = email_attachments($mymsg);
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
define_tag(
	'attachments',
	-namespace='email_',
	-req='in', -copy,
	-priority='replace',
	-description='Returns an array of email attachment data for the given message.'
);
	protect;
		#in = email_parse(#in);
	/protect;
	
	local('out') = array;

	iterate(#in, local('i'));
		if(#i->content_disposition >> 'attachment' || #i->content_disposition >> 'inline');
			local('item') = map;
			#item->insert('data' = #i->body);
			#item->insert('name' = #i->content_type('name'));
			#item->insert('type' = #i->content_type->split(';')->first);
			#item->insert('size' = #i->body->size);
			#out->insert(#item);
		/if;
	/iterate;

	return(#out);
/define_tag;

 

Related Tags



Comments

none

Email:


Password:



Newest

Most Popular