How do I email attachment to Moodle?

Asked

Viewed 34 times

0

I’m trying to do this way, but the attachment is not sent, only 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 the email_to_user it is possible?

  • I think the file name could not have space Arquivo15-03-2018 13-28.xlsx.

  • I’m gonna test it, huh!

  • It didn’t work. You tricked me!

  • Oh! They already voted negative...! And they didn’t even mention the reason. They didn’t even edit if they saw something wrong... For these and others that...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.