sending email from action button

This sub-forum is for discussing all topics related to AppGini Helper JavaScript Library, provided by bizzworxx as a third-party AppGini plugin.
Post Reply
ushay
Veteran Member
Posts: 54
Joined: 2020-06-26 21:30

sending email from action button

Post by ushay » 2023-04-06 06:05

hello,

i wish to send an email from an action button as described below:
https://appgini.bizzworxx.de/products/j ... n-buttons/

my problem is that the only way i know to send mails is in php code according to your step by step guide and i see only a button the runs javascript function.

can you please suggest a solution?

shay.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: sending email from action button

Post by jsetzer » 2023-04-06 06:45

(1) Simplest way: don't addButton but addLink. As HREF use:

mailto:[email protected]

This will open up the installed mail client software, if any, and let's the user write and send an email.

(2) If you need more automated process, addButton, in click-function, use javascript/AJAX to call a custom, serverside script. Pass any values from client to server as payload. In PHP, use standard AppGini mail functions to make use of configured SMTP settings or configured sebdmail settings.

(3) You may Integrate with a SaaS email service provider
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

ushay
Veteran Member
Posts: 54
Joined: 2020-06-26 21:30

Re: sending email from action button

Post by ushay » 2023-04-06 07:02

dear jsetzer,

thanks for your reply,

i have already configured and used the AppGini mail function.
i only need a button to send the link to the present page (selected ID).
before that i added an action button to footer-extras.php by then the button displays in all tables.
is there a way to not display this button in the other tables?

shay.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: sending email from action button

Post by jsetzer » 2023-04-06 09:28

This means you already have HTML code for the button which triggers sending an email. Great.

Why not keep it in footer-extras.php but only render the button under given conditions, for example only if current table name == 'YOURTABLENAME'.

Or, as mentioned before, use .addButton or .addLink in specific TABLENAME-dv.js scripts and render the buttons there. If you

already have a working HREF, you can use .addLink().

How to add buttons to Detail View (dv):
http://www.appgini.de/docs/Javascript-L ... ttons.html
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

ushay
Veteran Member
Posts: 54
Joined: 2020-06-26 21:30

Re: sending email from action button

Post by ushay » 2023-04-06 11:30

thanks again Jsetzer,

is there a way to now the current table name in footer-extras.php?

Shay,

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: sending email from action button

Post by jsetzer » 2023-04-06 11:39

is there a way to now the current table name in footer-extras.php?
See thread here:
viewtopic.php?t=3097

TL;DR

Code: Select all

$table_file=basename($_SERVER['SCRIPT_FILENAME']);
$tablename=substr($table_file,0, -9);
Credit goes to globaldrip8
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

ushay
Veteran Member
Posts: 54
Joined: 2020-06-26 21:30

Re: sending email from action button

Post by ushay » 2023-04-06 13:40

thank you very much Jsetzer,
the code above solved my problem, you are the best as always.

Post Reply