From 1ec8d12a7b125d41ecb723c5d83f2afef95408e9 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sun, 31 Jul 2016 09:40:25 +0200 Subject: 0.5.2 emails --- classes/Offer.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'classes/Offer.php') diff --git a/classes/Offer.php b/classes/Offer.php index 16e0d20..7b0d2fc 100644 --- a/classes/Offer.php +++ b/classes/Offer.php @@ -293,6 +293,32 @@ class Offer extends Model{ } } + /** + * Make a mailer to send about this offer + * + * @return Mailer The mailer + */ + public function mailer() { + $mailer = new Mailer($this->pdo); + $mailer->setOffer($this); + return $mailer; + } + + /** + * Send the invoice to the contact + * + * @return bool The result of Mailer::send + */ + public function send() { + $mailer = $this->mailer(); + + $mailer->addAttachment($this->getInvoiceFile()->getFilenamePath()); + $mailer->Subject = 'Your invoice'; + $mailer->Body = 'Here is your invoice.'; + + return $mailer->send(); + } + /** * Make a new assignment linked to this order * -- cgit v1.2.3