<!DOCTYPE html>
<html lang="en">

{{fscript
	emails := selectedObjects sortedArrayUsingDescriptors:{(NSSortDescriptor sortDescriptorWithKey:'DMIRecordDate' ascending:false)}.
	globals setEmailsForDisplay:emails.
}}

<head>
	<meta charset="utf-8">
	<link rel="stylesheet" href="{{framework}}/default.css" type="text/css" charset="utf-8">
	<link rel="stylesheet" href="{{framework}}/screen.css" type="text/css" charset="utf-8" media="screen">
	<link rel="stylesheet" href="{{framework}}/print.css" type="text/css" charset="utf-8" media="print">
	
</head>


<body>
	<h2>{{localize 'Emails'}}</h2>

	<table>
		{{foreach email emailsForDisplay do}}
			<tr>
			<td>
				<table>
					<tr width=80%>
						<td>
						Email Subject: <b>{{email.subject}}</b><br>
						From:  {{email.fromString}}<br>
						To:  {{email.toString}}<br>
						{{if email.carbonCopyString}}
							CC:  {{email.carbonCopyString}}<br>
						{{endif}}
						</td>
						<td>
						Email Date:<br> <b>{{email.emailMessageDate.mcShortDate}}</b>
						</td>
						<td>
						Recorded On: <br><b>{{email.DMIRecordDate.mcShortDate}}</b>
						</td>
						<td>
						Modify Date:<br> <b>{{email.modifyDate.mcShortDate}}</b>
						</td>
					</tr>
				</table>
				<br>
				Content:</b><br><br>
				{{fscript	
					htmlString := NSAttributedString htmlRepresenation:((email largeData) attributedStringRepresentation).
					htmlString.
				}}
				
				<br><br><br><br><br>
			</td>
			</tr>{{endforeach do}}	
	</table>

	<br>
	<br>
	<div id="reportfooter">
	{{localize 'Generated by {{objectContext.user.contact.cachedName}} on {{date}}'}}.		
	</div>

</body>
</html>