SENDER email address of the email template is note being used by TICKET module when sending an email message from a ticket [EASY SOLUTION PROPOSED AND TESTED] #31999
Labels
Bug
This is a bug (something does not work as expected)
Bug
When from a ticket card (of Ticket module) we try to send an email (so, "add message" with the option "send message by email" checkmarked), and if we use the select box to choose an email template, then the email being sent doesn't use the "from" attribute of that email template.
@eldy I have solved it after two hours of inverse engineering to find why it was happening. The problem is at the file:
/htdocs/ticket/class/ticket.class.php (line #3064)
The function
sendTicketMessageByEmail()
takes as sender this global value independently of the template:Solution i've used:
where now there is this:
I've put this other:
/htdocs/ticket/class/ticket.class.php (line #3064)
instead of:
we can put this:
in other words, we check if by
$_POST
we get a value for the variableemail_from
.Conclusion
I have tested it and it runs well. In fact, it's quite simple: take the sender value of the email template when choosing it on the web form to send the email, and then take that value on the
sendTicketMessageByEmail()
function if it's not empty.I suspect that sometime in the past someone introduced the possibility of set the "email from" attribute in the "email templates" (as a new Dolibarr feature) but because Ticket module is quite "special" then this feature was not being used there.
Dolibarr Version
20.X at least
Environment PHP
No response
Environment Database
No response
Steps to reproduce the behavior and expected behavior
Basically: you must send an email from an existing ticket using an specific email template which has defined as SENDER a customized email address.
Step by step:
Attached files
No response
The text was updated successfully, but these errors were encountered: