args['recipient']; $name = $this->args['name']; $subject = $this->args['subject']; $body = $this->args['body']; $mail = $register->get('smtp'); /* @var $mail \PHPMailer\PHPMailer\PHPMailer */ $mail->addAddress($recipient, $name); $mail->Subject = $subject; $mail->Body = $body; $mail->AltBody = strip_tags($body); try { $mail->send(); } catch (\Exception $error) { throw new Exception('Error sending mail: ' . $error->getMessage(), 500); } } public function tearDown() { // ... Remove environment for this job } }