Call Us:

  • +1 212 386 5676
  • +44 (0)1273 666 355
  • +61 (0)3 9682 2441
  • +7 383 332 40 55
Intranet & Extranet Manager: An integrated platform that will grow with your business
Translations of this page:

Send an Email Notification through plugin

For basic information on plugins, please refer: Infocapture plugins

In this section we would see how to send an email notification to the entered email address if the “Send Email” checkbox is checked

You can find the xml file of the test project here:

Lets suppose we have got this test project with ID = 12

For this purpose we would need plugin_12_add_issue.php file

<?php>
function hd_plugin_12_add_issue($params)
{
	//This function is used to send an Email Notification Template
	//$email_address: The email id to send an Email Notification
	//$id: id of the Notification Template
	//$templates: An array which consists the template
	function sendMessage($email_address, $id, $templates)
	{
		$msg = new ClaMailMessage('utf-8');
		$msg->SetFrom("noreply@claromentis.com");
		$msg->SetTo($email_address);
		$msg->SetSubject($templates["subj"]["$id"]);
 
		if($templates["html"]["$id"])
		{
			$msg->SetTxtBody(Html2Plain($templates["body"]["$id"]));
			$msg->SetHtmlBody($templates["body"]["$id"]);
		}
		else
		{
			$msg->SetTxtBody($templates["body"]["$id"]);
		}
		$msg->Send();
	}
	
	//Creating neccessary objects while used in parsing
	$issue = new HDIssue();
	$issue->Load($params["issue"]["id"]);
	$issue->GetFormData();
 
	//Getting all Notifications from the project
	$project = new HDProject();
	$project->Load($params["project"]["id"]);
	list($notif_templates, $notif_settings) = $project->GetNotifSettings();
 
	$fbform = new FBForm();
	$pid = 12;
 
	if(!$project->Load($pid))
	{
		$errno = "Cannot load current project";
		vard2($errno);
		exit;
	}
	$fbform = $project->getForm();
	$fbform->loadFields();
	$fd = $issue->GetFormData();
	
	if ($fd)
	{
		$fd->loadAllData();
	}
	$fd->LoadFormPrototype($form);
	$fd->loadAllData();
	$fd->GetFieldsData();
	
	//To fetch the values: email and send of the form
	$values = $params["issue"]["fields_values"];
 
	$templates = array();
	$templates["body"][0] = "";
	$templates["subj"][0] = "";
	$templates["html"][0] = "";
 
	$tmpl = parse_ic_templates($params);
 
	if($values['send'] == 1)
		sendMessage($values['email'], "1", $tmpl);
}
?>

Place the above file in folder: /httpdocs/intranet/helpdesk/plugins/

Check the checkbox to send an email notification to the entered email address.

After reporting the issue, the person with the above mention email address would receive an email notification.

 
help/infocapture/plugins/send_an_email_notification_through_plugin.txt · Last modified: 26/08/2009 06:41 by sweta
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki