Fixed File attached in an email

Status
Not open for further replies.

gilb33

New Member
Good morning,
I am in Fabrik4 joomla 5, and I have a form which has its validation with two plugins sending two emails, one to the member and the other to the treasurer of the association.
In the first email, a file is attached:

//email information reservation accepted
//Definition of attached file
$file = array();
$file [0] = $_SERVER['DOCUMENT_ROOT'].'images/mcbm/documents/recepisse/'.$this->data['mcbm_adherents___recepisse'];
return $file;

It works very well...

But in the second mail plugin, this same file is attached while there is no definition in the attachment evaluation.
I tried without success to put
$file = array();
$file[0] =' ' ;
return $file;
I still have the file attached to the email....
If you have a solution, thank you.
Sincerely
Gilbert
 
Good morning
Thank you Wezetel for your response.
I tried changing the variable name, the result is the same.
I also tried changing the file name:
$file = array();
$file[0] = $_SERVER['DOCUMENT_ROOT'].'/images/tactac/RIB.pdf';
return $file;
And I obtain two files attached in the message, that of the first email and the RIB of the second email.
You should try to reverse the order in the list of plugins....
Obviously Fabrik keeps a file sent to all the plugins that follow.
Sincerely
 
Where exactly are you doing this? In a form/list email plugin? Can you share more of the code please?
 
Good morning,
Thank you Achartier for your response.
It's in a form where I have two email plug-ins that follow each other.
In the first, I define an attached file:
$file = array();
$file [0] = $_SERVER['DOCUMENT_ROOT'].'images/mcbm/documents/recepisse/'.$this->data['mcbm_adherents___recepisse'];
return $file;
In the second I do not specify an attached file and I still have the same attached file in the email.
Sincerely
 

Attachments

  • Capture d’écran du 2024-02-04 18-04-54.png
    Capture d’écran du 2024-02-04 18-04-54.png
    59.6 KB · Views: 38
  • Capture d’écran du 2024-02-04 18-05-17.png
    Capture d’écran du 2024-02-04 18-05-17.png
    49.9 KB · Views: 40
Add
$this->attachments = [];
in plugins\fabrik_form\email\email.php line 87 to reset the attatchments in case of multiple email plugins.
 
Good morning,
Many thanks to Troester and all of you for your help.
I just did a test and it works!
Sincerely
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top