dolibarr/htdocs/core/modules/mailings
MDW d3725ac73a
Qual: Fix 'SqlInjection' notices (#39230)
* Fix(ci): Add exceptions for 'mouvement' (codespell)

* Qual: Fix 'SqlInjection' notices

# Qual: Fix 'SqlInjection' notices

Batch of 25 files with changes to fix 'SqlInjection' Notices
2026-07-20 15:28:26 +02:00
..
advthirdparties.modules.php Qual: Fix 'SqlInjection' notices (#39228) 2026-07-20 15:26:30 +02:00
contacts1.modules.php Qual: Fix french comments and improve detector (#39026) 2026-07-01 12:26:51 +02:00
eventorganization.modules.php
fraise.modules.php Qual: Fix 'SqlInjection' notices (#39228) 2026-07-20 15:26:30 +02:00
modules_mailings.php Qual: Fix french comments and improve detector (#39026) 2026-07-01 12:26:51 +02:00
partnership.modules.php
pomme.modules.php Qual: Fix 'SqlInjection' notices (#39228) 2026-07-20 15:26:30 +02:00
README
thirdparties.modules.php Qual: Fix 'SqlInjection' notices (#39230) 2026-07-20 15:28:26 +02:00
thirdparties_services_expired.modules.php
xinputfile.modules.php FIX: Translate French code comments to English in core module 2026-06-28 13:43:41 +02:00
xinputuser.modules.php FIX: Translate French code comments to English in core module 2026-06-28 13:43:41 +02:00

README (english)
------------------------------------
Adding your own email selector module
------------------------------------


If you want to add your own emails selector/import module. This is steps to follow
to add you own email predefined selector:


***** STEP 1 *****

Copy file
htdocs/core/modules/mailings/example.modules.php
into
htdocs/core/modules/mailings/myselector.modules.php

You can choose value of your choice instead of "myselector" in name of new file. The file name must NOT start with "mailing".


***** STEP 2 *****

Edit this file myselector.modules.php and change following text:

"class mailing_example"           into    "class mailing_myselector"				# You must add the prefix "mailing_" here.
"var $name='example';"            into    var $name='myselector';
"var $desc='...';"                into    var $desc='A text to describe selector';

Then add code inside the "add_to_target" function. What you must do is simply
fill the $target PHP array with one record for each email your selector must return.

You can choose the way you get data: From a file, a database. You are free,
the only requirement is that the $target array is filled by records that are
themselves array of: ('email', 'name', 'firstname', 'other').

This is for example how you can fill the $target array:

// ----- Your code start here -----
$target[0]=array('email'=>'email_0','name'=>'name_0','firstname'=>'firstname_0', 'other'=>'other_0');
...
$target[n]=array('email'=>'email_n','name'=>'name_n','firstname'=>'firstname_n', 'other'=>'other_n');
// ----- Your code end here -----

and call the method

parent::addTargetsToDatabase($mailing_id, $target);


***** STEP 3 *****

Once this file has been edited, you can go to the Dolibarr emailing feature,
you will see a new line selector in the "targets" editor of emailing tool.