We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 43009
    • 38 Posts
    Hi everybody,

    I want to send local file from server, not file submited through form,
    I tried to add un custom hook like :
    <?php
    $base_path = $modx->config['base_path'];
    $pdf = 'file.pdf';
    $file = $base_path.$pdf;
    if (file_exists($file)) {
    	$scriptProperties['hook']->modx->mail->mailer->AddAttachment($file);
    return true;
    }else{
    return false;
    }
    
    

    Here my FormIt call
    [[!FormIt?
    &hooks=`Attachment,email,redirect`
    &emailTpl=`devisTpl` 
    &emailSubject=`Subject` 
    &emailTo=`[email protected]` 
    &redirectTo=`6` 
    &validate=`nospam:blank,email:required`
    ]]
    


    After the "submit", i have a blank page, so it's not working.

    Could someone help me please ?