Difference between revisions of "Customize the email sending message"
Line 1: | Line 1: | ||
− | + | If you are looking for ways to customize the messages created automatically when sending an invoice, a reminder or a proposal by email, here are some notes from a Dolibarr user that should make your task easier: | |
− | = | + | = Personalize the sending of documents by E-mail = |
− | + | With Dolibarr, it is possible to send the documents directly by E-mail with the Send by E-mail button. A form appears to select the recipients and an automatic message is added in the message area. | |
== Dolibarr >= 9 == | == Dolibarr >= 9 == | ||
− | * | + | * On Dolibarr versions greater than or equal to v9, it is enough to add an email template in the menu''''Tools - Email template'''. |
− | + | If there are several models entered for the same context, Dolibarr will take the first one (the one with the weakest position field therefore) | |
− | |||
== Dolibarr <= 8 == | == Dolibarr <= 8 == | ||
− | * | + | * On Dolibarr versions lower than v8, the predefined message is saved in the Dolibarr languages folder |
− | <code>/htdocs/langs/ | + | <code>/htdocs/langs/en_en/other.lang</code> |
− | + | To customize this message, you must modify the following lines: | |
<code> | <code> | ||
− | PredefinedMailContentSendInvoice= | + | PredefinedMailContentSendInvoice=Please find attached the invoice __FACREF__\n\nRegards\n\n |
− | PredefinedMailContentSendInvoiceReminder= | + | PredefinedMailContentSendInvoiceReminder=We bring to your attention that the __FACREF__ invoice does not appear to have been paid. So here it is, as a reminder, as an attachment.\n\nRegards\n\n |
− | PredefinedMailContentSendProposal= | + | PredefinedMailContentSendProposal=Please find attached the commercial proposal __PROPREF__\n\nRegards\n\n |
− | PredefinedMailContentSendOrder= | + | PredefinedMailContentSendOrder=Please find attached the order form __ORDERREF__\n\nRegards\n\n |
− | PredefinedMailContentSendSupplierOrder= | + | PredefinedMailContentSendSupplierOrder=Please find attached our order __ORDERREF__\n\nRegards\n\n |
− | PredefinedMailContentSendSupplierInvoice= | + | PredefinedMailContentSendSupplierInvoice=Please find attached the invoice __FACREF__\n\nRegards\n\n |
</code> | </code> | ||
− | + | Messages can be written either in HTML or plain text. | |
− | + | If you choose a simple text format, you must write \n to make a line break. | |
− | + | If you prefer a message formatted in HTML, just use the standard HTML tags to format your message ((<br> : carriage return, <b>my text</b> for bold etc...) | |
− | = | + | = Customize variables on a Dolibarr version = |
== Dolibarr >= 8 == | == Dolibarr >= 8 == | ||
− | + | Many variables can be used in your email template. | |
− | + | Here is a non-exhaustive list. | |
<pre> | <pre> | ||
__USER_SIGNATURE__ -> Alice - 123 __USER_LASTNAME__ ... | __USER_SIGNATURE__ -> Alice - 123 __USER_LASTNAME__ ... | ||
Line 125: | Line 124: | ||
</pre> | </pre> | ||
− | + | To make sure you have an up-to-date list, you can click on the "?" symbol next to the "Content" label when you create or modify your email template. | |
− | |||
== Dolibarr <= 7 == | == Dolibarr <= 7 == | ||
− | + | When we look at the predefined messages we see that the part number is replaced by a variable __FACREF__, __ORDERREF__ | |
− | + | To send invoices, if you want the following message: | |
<code> | <code> | ||
− | + | Dear Sir, | |
− | + | Please find attached the invoice 2011-090 | |
− | + | Invoice: 2011-090 | |
− | Date : 27/07/2011 | + | Date: 27/07/2011 |
− | + | Amount: € 85.00 | |
− | + | Please make the payment by bank transfer to the account whose bank details appear at the bottom of the invoice. | |
− | + | Sincerely | |
− | + | Computer 81 | |
− | + | Computer 81 - 16, Portal Street - 81600 Gaillac - France | |
− | + | Phone: 05.81.31.48.00 - 06.47.94.94.52.38 - Email: contact@computer81.com | |
− | Web : www. | + | Web: www.computer81.com |
</code> | </code> | ||
− | + | So, to arrive at this result automatically, it is necessary to add the variables __FACDATE__ and __FACTOTALTTC__ | |
− | + | To do this, we need to modify the following file: | |
<code>/htdocs/compta/facture.php</code> | <code>/htdocs/compta/facture.php</code> | ||
− | + | do a search for "__FACREF__" in your editor and you will find the following line: | |
<source lang="php">// Tableau des substitutions | <source lang="php">// Tableau des substitutions | ||
Line 165: | Line 163: | ||
$formmail->substit['__FACREF__']=$object->ref;</source> | $formmail->substit['__FACREF__']=$object->ref;</source> | ||
− | + | To add the variables insert the following 2 lines:
| |
<source lang="php">$formmail->substit['__FACDATE__']=date('d/m/Y',$object->date); | <source lang="php">$formmail->substit['__FACDATE__']=date('d/m/Y',$object->date); | ||
Line 171: | Line 169: | ||
$formmail->substit['__FACTOTALTTC__']=number_format($object->total_ttc,2,',',' ');</source> | $formmail->substit['__FACTOTALTTC__']=number_format($object->total_ttc,2,',',' ');</source> | ||
− | + | You can now insert the date and amount of the invoice in your automatic message. | |
− | |||
− | |||
+ | If you need other variables to write your message, go to the file | ||
<code>htdocs/compta/facture/class/facture.class.php</code> | <code>htdocs/compta/facture/class/facture.class.php</code> | ||
− | + | You will have the list of variables that you can use with the object $object | |
− | + | For example, for the payment deadline you will find in this file the following line: | |
var $date_lim_reglement; | var $date_lim_reglement; | ||
− | + | To use it add to your substitution table | |
<source lang="php">$formmail->substit['__FACDATELIMREG__']=date('d/m/Y',$object->date_lim_reglement);</source> | <source lang="php">$formmail->substit['__FACDATELIMREG__']=date('d/m/Y',$object->date_lim_reglement);</source> |
Revision as of 20:59, 14 May 2019
If you are looking for ways to customize the messages created automatically when sending an invoice, a reminder or a proposal by email, here are some notes from a Dolibarr user that should make your task easier:
Personalize the sending of documents by E-mail
With Dolibarr, it is possible to send the documents directly by E-mail with the Send by E-mail button. A form appears to select the recipients and an automatic message is added in the message area.
Dolibarr >= 9
- On Dolibarr versions greater than or equal to v9, it is enough to add an email template in the menu'Tools - Email template.
If there are several models entered for the same context, Dolibarr will take the first one (the one with the weakest position field therefore)
Dolibarr <= 8
- On Dolibarr versions lower than v8, the predefined message is saved in the Dolibarr languages folder
/htdocs/langs/en_en/other.lang
To customize this message, you must modify the following lines:
PredefinedMailContentSendInvoice=Please find attached the invoice __FACREF__\n\nRegards\n\n
PredefinedMailContentSendInvoiceReminder=We bring to your attention that the __FACREF__ invoice does not appear to have been paid. So here it is, as a reminder, as an attachment.\n\nRegards\n\n
PredefinedMailContentSendProposal=Please find attached the commercial proposal __PROPREF__\n\nRegards\n\n
PredefinedMailContentSendOrder=Please find attached the order form __ORDERREF__\n\nRegards\n\n
PredefinedMailContentSendSupplierOrder=Please find attached our order __ORDERREF__\n\nRegards\n\n
PredefinedMailContentSendSupplierInvoice=Please find attached the invoice __FACREF__\n\nRegards\n\n
Messages can be written either in HTML or plain text. If you choose a simple text format, you must write \n to make a line break. If you prefer a message formatted in HTML, just use the standard HTML tags to format your message ((<br> : carriage return, <b>my text</b> for bold etc...)
Customize variables on a Dolibarr version
Dolibarr >= 8
Many variables can be used in your email template. Here is a non-exhaustive list.
__USER_SIGNATURE__ -> Alice - 123 __USER_LASTNAME__ ... __USER_ID__ -> 12 __USER_LOGIN__ -> admin __USER_LASTNAME__ -> Adminson __USER_FIRSTNAME__ -> Alice __USER_FULLNAME__ -> Alice Adminson __USER_SUPERVISOR_ID__ -> 2 __USER_REMOTE_IP__ -> 127.0.0.1 __MYCOMPANY_NAME__ -> MyBig Company __MYCOMPANY_EMAIL__ -> testldr10@gmail.com __MYCOMPANY_PROFID1__ -> 123456 __MYCOMPANY_PROFID2__ -> __MYCOMPANY_PROFID2__ __MYCOMPANY_PROFID3__ -> __MYCOMPANY_PROFID3__ __MYCOMPANY_PROFID4__ -> __MYCOMPANY_PROFID4__ __MYCOMPANY_PROFID5__ -> __MYCOMPANY_PROFID5__ __MYCOMPANY_PROFID6__ -> __MYCOMPANY_PROFID6__ __MYCOMPANY_CAPITAL__ -> 10001 __MYCOMPANY_FULLADDRESS__ -> 21 Jump street..ll..ee "ddddd, 75500 MyTown, France __MYCOMPANY_ADDRESS__ -> 21 Jump street..ll..ee "ddddd __MYCOMPANY_ZIP__ -> 75500 __MYCOMPANY_TOWN__ -> MyTown __MYCOMPANY_COUNTRY__ -> France __MYCOMPANY_COUNTRY_ID__ -> 1 __MYCOMPANY_CURRENCY_CODE__ -> EUR __ID__ -> __ID__ __REF__ -> __REF__ __REF_CLIENT__ -> __REF_CLIENT__ __REF_SUPPLIER__ -> __REF_SUPPLIER__ __EXTRAFIELD_XXX__ -> __EXTRAFIELD_XXX__ __THIRDPARTY_ID__ -> __THIRDPARTY_ID__ __THIRDPARTY_NAME__ -> __THIRDPARTY_NAME__ __THIRDPARTY_NAME_ALIAS__ -> __THIRDPARTY_NAME_ALIAS__ __THIRDPARTY_EMAIL__ -> __THIRDPARTY_EMAIL__ __MEMBER_ID__ -> __MEMBER_ID__ __MEMBER_CIVILITY__ -> __MEMBER_CIVILITY__ __MEMBER_FIRSTNAME__ -> __MEMBER_FIRSTNAME__ __MEMBER_LASTNAME__ -> __MEMBER_LASTNAME__ __PROJECT_ID__ -> __PROJECT_ID__ __PROJECT_REF__ -> __PROJECT_REF__ __PROJECT_NAME__ -> __PROJECT_NAME__ __CONTRACT_HIGHEST_PLANNED_START_DATE__ -> Highest date planned for a service start __CONTRACT_HIGHEST_PLANNED_START_DATETIME__ -> Highest date and hour planned for service start __CONTRACT_LOWEST_EXPIRATION_DATE__ -> Lowest data for planned expiration of service __CONTRACT_LOWEST_EXPIRATION_DATETIME__ -> Lowest date and hour for planned expiration of service __ONLINE_PAYMENT_URL__ -> UrlToPayOnlineIfApplicable __ONLINE_PAYMENT_TEXT_AND_URL__ -> TextAndUrlToPayOnlineIfApplicable __SECUREKEYPAYMENT__ -> Security key (if key is not unique per record) __SECUREKEYPAYMENT_MEMBER__ -> Security key for payment on a member subscription (one key per member) __SECUREKEYPAYMENT_ORDER__ -> Security key for payment on an order __SECUREKEYPAYMENT_INVOICE__ -> Security key for payment on an invoice __SECUREKEYPAYMENT_CONTRACTLINE__ -> Security key for payment on a a service __DIRECTDOWNLOAD_URL_PROPOSAL__ -> Direct download url of a proposal __DIRECTDOWNLOAD_URL_ORDER__ -> Direct download url of an order __DIRECTDOWNLOAD_URL_INVOICE__ -> Direct download url of an invoice __SHIPPINGTRACKNUM__ -> Shipping tacking number __SHIPPINGTRACKNUMURL__ -> Shipping tracking url __DATE_YMD__ -> __DATE_YMD__ __DATE_DUE_YMD__ -> __DATE_DUE_YMD__ __AMOUNT__ -> __AMOUNT__ __AMOUNT_EXCL_TAX__ -> __AMOUNT_EXCL_TAX__ __AMOUNT_VAT__ -> __AMOUNT_VAT__ __AMOUNT_FORMATED__ -> __AMOUNT_FORMATED__ __AMOUNT_EXCL_TAX_FORMATED__ -> __AMOUNT_EXCL_TAX_FORMATED__ __AMOUNT_VAT_FORMATED__ -> __AMOUNT_VAT_FORMATED__ __DAY__ -> 18 __DAY_TEXT__ -> Monday __DAY_TEXT_SHORT__ -> Mo __DAY_TEXT_MIN__ -> M __MONTH__ -> 3 __MONTH_TEXT__ -> March __MONTH_TEXT_SHORT__ -> Mar __MONTH_TEXT_MIN__ -> M __YEAR__ -> 2019 __PREVIOUS_DAY__ -> 17 __PREVIOUS_MONTH__ -> 2 __PREVIOUS_YEAR__ -> 2018 __NEXT_DAY__ -> 19 __NEXT_MONTH__ -> 4 __NEXT_YEAR__ -> 2020 __ENTITY_ID__ -> 1 __DOL_MAIN_URL_ROOT__ -> http://localhostgit/dolibarr_dev/htdocs __(AnyTranslationKey)__ -> Translation __[AnyConstantKey]__ -> Value of constant
To make sure you have an up-to-date list, you can click on the "?" symbol next to the "Content" label when you create or modify your email template.
Dolibarr <= 7
When we look at the predefined messages we see that the part number is replaced by a variable __FACREF__, __ORDERREF__
To send invoices, if you want the following message:
Dear Sir,
Please find attached the invoice 2011-090
Invoice: 2011-090
Date: 27/07/2011
Amount: € 85.00
Please make the payment by bank transfer to the account whose bank details appear at the bottom of the invoice.
Sincerely
Computer 81
Computer 81 - 16, Portal Street - 81600 Gaillac - France
Phone: 05.81.31.48.00 - 06.47.94.94.52.38 - Email: contact@computer81.com
Web: www.computer81.com
So, to arrive at this result automatically, it is necessary to add the variables __FACDATE__ and __FACTOTALTTC__ To do this, we need to modify the following file:
/htdocs/compta/facture.php
do a search for "__FACREF__" in your editor and you will find the following line:
// Tableau des substitutions
$formmail->substit['__FACREF__']=$object->ref;
To add the variables insert the following 2 lines:
$formmail->substit['__FACDATE__']=date('d/m/Y',$object->date);
$formmail->substit['__FACTOTALTTC__']=number_format($object->total_ttc,2,',',' ');
You can now insert the date and amount of the invoice in your automatic message.
If you need other variables to write your message, go to the file
htdocs/compta/facture/class/facture.class.php
You will have the list of variables that you can use with the object $object For example, for the payment deadline you will find in this file the following line: var $date_lim_reglement; To use it add to your substitution table
$formmail->substit['__FACDATELIMREG__']=date('d/m/Y',$object->date_lim_reglement);