| @@ 125-136 (lines=12) @@ | ||
| 122 | ||
| 123 | // opret e-mailen |
|
| 124 | $email = new Email($this->context->getKernel()); |
|
| 125 | if (!$email->save(array( |
|
| 126 | 'contact_id' => $contact->get('id'), |
|
| 127 | 'subject' => $subject, |
|
| 128 | 'body' => $body . "\n\n" . $signature->getAsText(), |
|
| 129 | 'from_email' => $from_email, |
|
| 130 | 'from_name' => $from_name, |
|
| 131 | 'type_id' => 10, // electronic invoice |
|
| 132 | 'belong_to' => $debtor->get('id') |
|
| 133 | ))) { |
|
| 134 | echo $email->error->view(); |
|
| 135 | throw new Exception('E-mailen kunne ikke gemmes'); |
|
| 136 | } |
|
| 137 | ||
| 138 | // tilknyt fil |
|
| 139 | if (!$email->attachFile($file_id, $filehandler->get('file_name'))) { |
|
| @@ 152-163 (lines=12) @@ | ||
| 149 | ||
| 150 | // opret e-mailen |
|
| 151 | $email = new Email($this->getKernel()); |
|
| 152 | if (!$email->save(array( |
|
| 153 | 'contact_id' => $contact->get('id'), |
|
| 154 | 'subject' => $subject, |
|
| 155 | 'body' => $body . "\n\n" . $signature->getAsText(), |
|
| 156 | 'from_email' => $from_email, |
|
| 157 | 'from_name' => $from_name, |
|
| 158 | 'type_id' => 10, // electronic invoice |
|
| 159 | 'belong_to' => $this->getDebtor()->get('id') |
|
| 160 | ))) { |
|
| 161 | echo $email->error->view(); |
|
| 162 | throw new Exception('E-mailen kunne ikke gemmes'); |
|
| 163 | } |
|
| 164 | ||
| 165 | // tilknyt fil |
|
| 166 | if (!$email->attachFile($file_id, $filehandler->get('file_name'))) { |
|