send email from action button

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
ushay
Veteran Member
Posts: 54
Joined: 2020-06-26 21:30

send email from action button

Post by ushay » 2020-07-02 18:42

HI,

i have added an action butten under the "MORE" tab.
no i want to send an email to a recipt.
i have tried to use the sendmail function as Ahmed posted:

sendmail(array(
'to' => 'recipient email',
'name' => 'recipient name (optional)',
'subject' => 'Mail subject',
'message' => 'Mail message, HTML allowed'
));

but not doing anything.
i have placed it in myproject-tv.js

what am i doing wrong?

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

Re: send email from action button

Post by jsetzer » 2020-07-03 05:27

The sendmail function is a PHP function which can be used on serverside.
The batch-function in hooks/TABLENAME-tv.js is a Javascript function which will be executed on clientside (browser).

You need a combination of both:
  • The batch-function (clientside) has to call a (serverside) PHP script and pass required data from the browser to the serverside PHP script, for example the primary keys (IDs) of selected (checked) rows.
  • An additional (serverside) PHP script for creating and sending the mail/mails
  • The serverside PHP script has to read the passed data, for example the primary keys or the selected rows
  • sendmail on your webserver or SMPT-settings have to be configured properly
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: send email from action button

Post by ushay » 2020-07-03 06:38

Dear Jsetzer,
thank you , the explaination is very clear and helpfull.
i have already configured the smtp on the admin settings page and tested to make sure that it works.
is there any guide with samples for the whole process ?
my final goal is to send a record to my technicians by mail.

thanks

Post Reply