This topic is locked
[SOLVED]

 Sending an email when a value is changed

5/12/2020 12:19:37 AM
PHPRunner General questions
Karlo_from_Germany author

I'm looking for the solution for my project and haven't found anything right in the forums yet. Maybe someone has an idea.

In my project a table has (among other values) a value with an ID ( file number ), an email address ( email ) and another value for the current status of the table content ( status ).
If the value of the status changes, a mail should be sent to the email address. The content of the mail should contain the ID (file number) and the current status (status).
Example of a mail: "The case with the file number 202000123456 now has the status "In process"!
Thanks for your ideas in advance

HJB 5/12/2020

https://xlinesoft.com/phprunner/docs/send_email_with_new_data.htm
... with smart greetings to "Buchholz in der Nordheide" ...
P.S. View as well "Predefined Actions" - https://xlinesoft.com/phprunner/docs/predefined-actions.htm

Karlo_from_Germany author 5/12/2020



https://xlinesoft.com/phprunner/docs/send_email_with_new_data.htm
... with smart greetings to "Buchholz in der Nordheide" ...
P.S. View as well "Predefined Actions" - https://xlinesoft.com/phprunner/docs/predefined-actions.htm


Thanks, I read it before, of course. OK, thats the Code I use and it works. I am now looking for the appropriate code to take the value of the recipient's email address from the table without having to enter it manually.

//********** Send email with new data ************
$email="????@?????.de"; (This value should be taken from the table)

$from="info@???????.de";

$msg="";

$subject="Vorgangsstatus geändert";



$msg.= "Nivadis: ".$values["Nivadis"]."\r\n";

$msg.= "Sachbearbeiter: ".$values["SB-Einsender"]."\r\n";

$msg.= "Betroffener: ".$values["Betroffener"]."\r\n";

$msg.= "Verfahrensart: ".$values["Verfahrensart"]."\r\n";

$msg.= "Aktueller Status: ".$values["Vorgangsstatus"]."\r\n";


$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];
HJB 5/12/2020



Thanks, I read it before, of course. OK, thats the Code I use and it works. I am now looking for the appropriate code to take the value of the recipient's email address from the table without having to enter it manually.

//********** Send email with new data ************
$email="????@?????.de"; (This value should be taken from the table)

$from="info@???????.de";

$msg="";

$subject="Vorgangsstatus geändert";
$msg.= "Nivadis: ".$values["Nivadis"]."\r\n";

$msg.= "Sachbearbeiter: ".$values["SB-Einsender"]."\r\n";

$msg.= "Betroffener: ".$values["Betroffener"]."\r\n";

$msg.= "Verfahrensart: ".$values["Verfahrensart"]."\r\n";

$msg.= "Aktueller Status: ".$values["Vorgangsstatus"]."\r\n";
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];



Given, the e-mail address is in the very same table like the changed record data, then you need

to replace the static placeholder "????@?????.de" being just a string by a variable (platzhalter).

Simply speaking, what is the recipient's email address field name in your table?
For better understanding drill through the following THREAD: https://asprunner.com/forums/topic/23466-send-email-to-email-field-of-another-table/
Though it's not direct to the topic, talking about usage of a recipient's mail address in another table than

the changed record oriented one in order to view useful sample code about the "platzhalter" (variable) issue.

Karlo_from_Germany author 5/12/2020



Given, the e-mail address is in the very same table like the changed record data, then you need

to replace the static placeholder "????@?????.de" being just a string by a variable (platzhalter).

Simply speaking, what is the recipient's email address field name in your table?
For better understanding drill through the following THREAD: https://asprunner.com/forums/topic/23466-send-email-to-email-field-of-another-table/
Though it's not direct to the topic, talking about usage of a recipient's mail address in another table than

the changed record oriented one in order to view useful sample code about the "platzhalter" (variable) issue.


Variable (Platzhalter) was the key.....works fine. Thank you!