package Ġcom . github . al . m fs . ews Ċ Ċ import Ġcom . github . al . m fs . sender . Sender Ċ import Ġcom . github . al . m fs . sender . Sender Context Ċ import Ġm icrosoft . exchange . web services . data . core . Exchange Service Ċ import Ġm icrosoft . exchange . web services . data . core . service . item . Email Message Ċ import Ġmu . Kotlin Logging Ċ import Ġjava . time . Duration Ċ import Ġkotlin . system . measure Time Millis Ċ Ċ private Ġval Ġlogger Ġ= ĠKotlin Logging . logger Ġ{} Ċ Ċ class ĠE ws Sender ( private Ġval Ġexchange : ĠExchange Service ) Ġ: ĠSender Ġ{ ĊĊĠĠĠ Ġoverride Ġvar Ġrecipients : ĠList < String > Ġ= ĠlistOf () ĊĊĠĠĠ Ġoverride Ġfun Ġsend ( context : ĠSender Context ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmessage Ġ= ĠEmail Message ( exchange ) ĊĠĠĠĠĠĠĠ Ġmessage . subject Ġ= Ġcontext . subject ĊĠĠĠĠĠĠĠ Ġmessage . attachments . add File Attachment ( context . attachment Name , Ġcontext . attachment Content ) ĊĠĠĠĠĠĠĠ Ġrecipients . forEach Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmessage . to Recipients . add ( it ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġlogger . info Ġ{ Ġ"${ context . metadata . marker } Ġsend Ġstarted " Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġduration Ġ= ĠDuration . of Millis ( measure Time Millis Ġ{ Ġmessage . send () Ġ}) ĊĠĠĠĠĠĠĠ Ġlogger . info Ġ{ Ġ"${ context . metadata . marker } Ġsend Ġfinished : Ġ${ duration . toString (). substring ( 2 )}" Ġ} ĊĠĠĠ Ġ} Ċ } Ċ