-
pasbonte
- Veteran Member
- Posts: 162
- Joined: 2013-02-06 09:49
Post
by pasbonte » 2019-04-02 10:21
Hello
I use this code to send a mel when a record is changed.
Code: Select all
foreach($data as $field => $value){
$messageData .= "$field: $value \n";
}
sendmail(array(
'to' => '[email protected]',
'name' => 'Recipient Name',
'subject' => 'Sortie Modifiée',
'message' => "Attention modification de la sortie: {$memberInfo['username']}: \n\n" . $messageData
));
But instead of the whole message I'd like to just have the link to click
MERCI !!!!
-
jsetzer
- AppGini Super Hero
- Posts: 1817
- Joined: 2018-07-06 06:03
- Location: Kiel, Germany
-
Contact:
Post
by jsetzer » 2019-04-02 10:37
The link should look like this:
Code: Select all
<a href="http://www.yourserver.com/path/tablename_view.php?SelectedID=12345">Click here</a>
You need to replace servername, path, tablename and ID by the appropriate values.
You can try this:
Code: Select all
$server = 'YOURSERVERNAME'; // eg. www.my-great-appgini-website.com
$path = 'YOUR-APP-PATH'; // eg. myapp
$tn = 'TABLENAME'; // name of your table
$text = 'Click here to open the record in your browser';
// dont's change the following lines -----------
$id = $data['selectedID'];
$href = "http://{$server}/{$path}/{$tn}_view.php?SelectedID={$id}";
$link = "<a href=\"{$href}\">{$text}</a>";
// ----------------------------------------------------
sendmail(array(
'to' => '[email protected]',
'name' => 'Recipient Name',
'subject' => 'Sortie Modifiée',
'message' => "Attention modification de la sortie: {$memberInfo['username']}: \n\n" . $link
));
I hope there is no typo.
Regards,
Jan
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readability
AppGini 24.10 Revision 1579 + all AppGini Helper tools
-
pasbonte
- Veteran Member
- Posts: 162
- Joined: 2013-02-06 09:49
Post
by pasbonte » 2019-04-02 13:31
I tried:
Code: Select all
function SORTIES_after_update($data, $memberInfo, &$args){
foreach($data as $field => $value){
$messageData .= "$field: $value \n";
// dont's change the following lines -----------
$id = $data['selectedID'];
$href = "http://{$server}/{$path}/{$tn}_view.php?SelectedID={$id}";
$link = "<a href=\"{$href}\">{$text}</a>";
// ----------------------------------------------------
}
sendmail(array(
'to' => '[email protected]',
'name' => 'Recipient Name',
'subject' => 'Sortie Modifiée',
'message' => "Attention modification de la sortie: {$memberInfo['username']}: \n\n" . $link
));
//'message' => "Attention modification de la sortie: {$memberInfo['username']}: \n\n" . $messageData . $link
));
return TRUE;
}
and i have:
Attention modification de la sortie: admin:
-
jsetzer
- AppGini Super Hero
- Posts: 1817
- Joined: 2018-07-06 06:03
- Location: Kiel, Germany
-
Contact:
Post
by jsetzer » 2019-04-02 14:04
You must not put the code on the for-loop
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readability
AppGini 24.10 Revision 1579 + all AppGini Helper tools
-
jsetzer
- AppGini Super Hero
- Posts: 1817
- Joined: 2018-07-06 06:03
- Location: Kiel, Germany
-
Contact:
Post
by jsetzer » 2019-04-02 14:05
You have forgotten $text variable
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readability
AppGini 24.10 Revision 1579 + all AppGini Helper tools
-
jsetzer
- AppGini Super Hero
- Posts: 1817
- Joined: 2018-07-06 06:03
- Location: Kiel, Germany
-
Contact:
Post
by jsetzer » 2019-04-02 14:06
I guess you have also forgotten $server, $path and $tn
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readability
AppGini 24.10 Revision 1579 + all AppGini Helper tools