@Override
public Object transformMessage(MuleMessage message, String outputEncoding) throws TransformerException
{
String endpointAddress = endpoint.getEndpointURI().getAddress();
SmtpConnector connector = (SmtpConnector) endpoint.getConnector();
String to = lookupProperty(message, MailProperties.TO_ADDRESSES_PROPERTY, endpointAddress);
String cc = lookupProperty(message, MailProperties.CC_ADDRESSES_PROPERTY, connector.getCcAddresses());
String bcc = lookupProperty(message, MailProperties.BCC_ADDRESSES_PROPERTY, connector.getBccAddresses());
String from = lookupProperty(message, MailProperties.FROM_ADDRESS_PROPERTY, connector.getFromAddress());
String replyTo = lookupProperty(message, MailProperties.REPLY_TO_ADDRESSES_PROPERTY, connector.getReplyToAddresses());
String subject = lookupProperty(message, MailProperties.SUBJECT_PROPERTY, connector.getSubject());
String contentType = lookupProperty(message, MailProperties.CONTENT_TYPE_PROPERTY, connector.getContentType());
Properties headers = new Properties();
Properties customHeaders = connector.getCustomHeaders();
if (customHeaders != null && !customHeaders.isEmpty())
{
headers.putAll(customHeaders);
}