//$Id: MailNotificationFilter.bsh,v 1.1.4.1 2002/10/21 11:53:40 chinnaraj Exp $
String[] recipients = { "username" }; // The list of recipients. 
domain = "xyz.com"; // The domain of the mail id.
mailServer = "localhost"; // mail server name.
from = "provisioning@localhost.com";
subject = "Provisioning Done";
message = "";
for(j = 0 ; j < recipients.length ; j++)
{
	recipients[j] = recipients[j]+"@"+domain;
}
//Getting the DeviceResults from the TemplateResult.
deviceResults = templateResult.getSubTagsByName("DeviceResult"); 
for(i = 0 ; i < deviceResults.size() ; i++) 
{
	deviceResult = deviceResults.elementAt(i);
	deviceName = deviceResult.getDeviceName(); //Getting the name of the device that is provisioned.
	message = message + "\nThe host " + deviceName + " has been Provisioned.\n" + "Details of Provisioning: \n";
	attributeResults = deviceResult.getSubTagsByName("AttributeResult");
	for(k = 0 ; k < attributeResults.size() ; k++)
	{
		attributeResult = attributeResults.elementAt(k);
		identifier = attributeResult.getIdentifier();
		resultMessage = attributeResult.getMessage();
		message = message + "Identifier="+ identifier + "    Result="+ resultMessage + "\n";
	}
}
message = message + "\n\nAutomated Mail";
smtpMailer = new com.adventnet.nms.smtp.SmtpMailer(mailServer,from,recipients,subject);
smtpMailer.sendMessage(message);
smtpMailer.close();
return templateResult;
