We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    I am trying to add a file to the reportmail from eForm but not a file uploaded by the user but a generated file (pdf) that i create by using the form fields.

    I tryed to add it in the files array, (this works that I get a file on my server) but how do I get this file attached with the send email?

    This is what I did: i called the on eFormOnBeforeMailSent

    <?php
    function attachFile( &$fields ){
    
    //...more pdf stuff...
    $pdf->Output(MODX_BASE_PATH . 'assets/pdf/facturen/file.pdf', 'F');
    
    $_FILES['attachment']['name'] = 'factuur123.pdf';
    $_FILES['attachment']['error'] = 0;
    $_FILES['attachment']['tmp_name'] = MODX_BASE_PATH . 'assets/pdf/facturen/file.pdf';
    $_FILES['attachment']['size'] = filesize(MODX_BASE_PATH . 'assets/pdf/facturen/file.pdf');
    
    return true;
    


    the pdf is created but the file is not attached even tho i have a [+attachment+] placeholder in the report.

    any idea how i can do this?
      follow me on twitter: @dimmy01
      • 7455
      • 2,204 Posts
      I found the solution..

      http://forums.modx.com/thread/46995/is-it-posible-to-atach-a-file-with-an-event

      It was even a treat by my self that was answerd years ago.

      But maybe its cool that if there will be a new eform that tis solution is added.
        follow me on twitter: @dimmy01