Automatic email sending when exceeding a value

Hi All,

When a value that I set is exceeded. I want an automatic alert email to be sent to the recipients I define.
How can I do that ?

Can you plese help me…
Thanks,

Hello
I suggest you a “SendMailAlerta” function, which receives the message as a parameter, and eventually the subject, which raises the SMTP parameters from an ini, and makes the delivery …

fuction SendMailAlert ($msg,$subject) {
	$array_ini = parse_ini_file("..\\Config.ini");
	$ServerSMTP = $array_ini['SMTPServer'];
	$UserSMTP = $array_ini['SMTPUser'];
	$PassSMTP = $array_ini['SMTPPass'];	
	$ToSMPT = $array_ini['SMTPTo'];	
	$AsuntoSMTP = $subject;
	$TipoSMTP = 'H';	
	$get_email = trim(rtrim({Email}));
	$FromSMTP = $get_email;
	$CopiasSMTP = '';
	$CopiasTipoSMTP = '';
	$PuertoSMTP =  $array_ini['SMTPPort'];
	$TipoConSTMP = 'N';
	$AdjuntoSMTP = '';
	$SSLSMTP = '';
	sc_mail_send($ServerSMTP, $UserSMTP, $PassSMTP, $FromSMTP, $ToSMPT, $AsuntoSMTP, $msg, $TipoSMTP, $CopiasSMTP, $CopiasTipoSMTP, $PuertoSMTP, $TipoConSTMP, $AdjuntoSMTP, $SSLSMTP);
}

Thanks,
But what value will this code be based on to send email?

I do not know your code and your specification … and how is it generated or obtained that value that would trigger the sending of mail …

For example, if it is a field that the user loads, it would be done in the “Validate” event, or in an Ajax “On Change” event, of the field

if ({MyValue} >= 100) {
    SendMailAlert("Valor exedido -> ".{MyValue}, "Valor Excedido);
}

That will depend on the logic of your process …

Thanks, I’ll try and let you know. :slight_smile: