Open caos30 opened 1 week ago
This is the expected behaviour to have all emails sent from the ticket interface to be sent with the from defined into TICKET_NOTIFICATION_EMAIL_FROM. The from should not come from the user form, for security and technical purpose (sending email should come from a email that is technically allowed). This is the goal of this option to set the from that is allowed to send email for ticket notification.
It's right that the email_from in templates were introduced for writing emails, not for ticket notification.
But i understand we may want to have the nale of sender for some messages. In such cases, sender email should be in reply-to. But this should be another option not yet available.
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:
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:
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