How to send an email attachment in Moodle?

0

I'm trying to do this, but the attachment is not sent, just the email.

$fileName       = 'Arquivo'.date('d-m-Y H-i').'.xlsx';
$directory      = $_SERVER['DOCUMENT_ROOT'].'/local/plugin/exports/'.$fileName;

# Envia e-mail para o supervisor
$userMail = $DB->get_record('user', ['id' => 2]);

email_to_user(
    $userMail, 
    $userMail, 
    'Assunto', 
    'Mensagem', 
    'Mensagem', 
    $directory, 
    $fileName
);

Using email_to_user is it possible?

    
asked by anonymous 15.03.2018 / 18:23

0 answers