Simplest API-way to send an email?

I’ve been working on a trigger for our installation of Dolibarr and I am now (almost) done. The last step is to send a confirmation email when the trigger occurs, but I find no way to do this in the API. Basically, I want an email to be sent to myself when trigger is due.

How do you send an email from the PHP-code that uses the mail-settings from within Dolibarr?

I can’t seem to see which version you are talking about? I use v18.

So here’s what I just did once, so it might not work.

  1. Click home in the top left.

  2. Click setup below in the left side

  3. click emails below in the left side.

  4. not in the top menu line, but the 2. menu line I select “Email templates”

  5. click + in the right side to add a new template.

  6. I return to the top left “Home”.

  7. Click Setup

  8. Click “Modules/Applications”

  9. search for “trigger” or “notification”.

  10. Click the cogwheel correlating to “Notifications on business event”

  11. Hopefully the one you need are listed somewhere under “Templates for notifications” - mine was (Customer proposal validated)

  12. Scroll further down to “List of automatic fixed notifications”

  13. Correlating to “Commercial proposal” I wrote my email address, and I got an email when I validated a proposal.

Hope this helps

1 Like

This was even easier than the way we were trying to do. Thanks.