1
$email = $this->subject($this->registrationBatch->retrieve()->emailSubject());
foreach($attachments as $file){
    $email->attach($file)
}
return $email;

how to unlink $file after send email ?

Komal12
  • 3,340
  • 4
  • 16
  • 25
abdul hanan
  • 40
  • 1
  • 8

1 Answers1

1

you can using deleteDirectory. example :

$email = $this->subject($this->registrationBatch->retrieve()->emailSubject());
   foreach($attachments as $file){
           if($email->attach($file)){
                 $dir = '../storage/email/';
                 File::deleteDirectory($dir, true); // will delete all file or folder in folder email
           }
   }
return $email;
Gangga
  • 26
  • 1
  • 3