Send email containing data just inserted in the table

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
facos79
Veteran Member
Posts: 45
Joined: 2014-10-29 12:31

Send email containing data just inserted in the table

Post by facos79 » 2017-10-31 14:09

Hi everyone, I'm crazy. I can not solve the problem.
I have a table where the assistance intervals are entered. Once you've entered the line, I would like to have it sent to my final customer an email containing the summary of what's included in the table or a link that points to the table's visible page without registration.
How do I do it?
Below the code. What am I doing wrong ?



Code: Select all

	function Interventi_after_insert($data, $memberInfo, &$args){


$EmailI=sqlValue("SELECT `Email` FROM `Clienti` WHERE `id`=".$data['Cliente']);
$dc=sqlValue("SELECT `Durata_ore` FROM `Contratti` WHERE `id`=".$data['Durata_contratto']);

$Clientem=sqlValue("SELECT `Ragione_Sociale` FROM `Clienti` WHERE `id`=".$data['Ragione_Sociale`']);
$Datam=sqlValue("SELECT `Data` FROM `Interventi` WHERE `id`=".$data['Cliente']);
$Descrizione_interventom=sqlValue("SELECT `Descrizione_intervento` FROM `Interventi` WHERE `id`=".$data['Cliente']);
$Durata_interventom=sqlValue("SELECT `Durata_intervento` FROM `Interventi` WHERE `id`=".$data['Cliente']);

$sum=sqlValue("SELECT sum(`Durata_intervento`) FROM `Interventi` WHERE `Cliente`=".$data['Cliente']);
		
$rr=$dc-$sum;
sql("UPDATE `Interventi` SET `Ore_rimanenti`='".$rr."' WHERE `id`=".$data['selectedID'],$eo);



	foreach($data as $field => $value){
		$messageData .= "$field: $value \n";
	}


@mail(
		// mail recipient
		"$EmailI",
		
		// subject
		"Intervento eseguito - Consulente Tecnico Informatico",
		
		// message
		" Ho eseguito un nuovo intervento, puoi visualizzare il riepilogo ".

	
"Cliente: $Clientem \n" .
"Data: $Datam \n" .
"Intervento: $Descrizione_interventom \n " .
"OreContratto: $dc \n" .
"Durata: $Durata_interventom \n" .
"Ore Rimanenti: $Ore_rimanenti \n" ,


		
		// sender address
		"From: info@email.net"


		
	);



		return TRUE;
	}

Abeer
Posts: 18
Joined: 2017-03-12 09:19

Re: Send email containing data just inserted in the table

Post by Abeer » 2017-11-14 07:57

have you tried to send email from your admin area and made sure that email configurations and sending email is working fine?

Post Reply