Skip to content

Commit

Permalink
Merge branch 'release/3.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Apr 15, 2019
2 parents 98bb17d + fed09bb commit eda7415
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v3.0.1
## 04/15/2019

1. [](#improved)
* Put a `try/catch` around email attachments and log any errors rather than hard fail
1. [](#bugfix)
* Fixed missing attachments when sending an email using a form [form#333](https://github.com/getgrav/grav-plugin-form/issues/333)

# v3.0.0
## 04/11/2019

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Email
version: 3.0.0
version: 3.0.1
testing: false
description: Enables the emailing system for Grav
icon: envelope
Expand Down
11 changes: 10 additions & 1 deletion email.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public function onFormProcessed(Event $event)
'form' => $form
);

// Copy files now, we need those.
// TODO: we need a better solution. Maybe we can use streams for the attachments?
$form->copyFiles();

$grav = Grav::instance();
$grav->fireEvent('onEmailSend', new Event(['params' => &$params, 'vars' => &$vars]));

Expand All @@ -89,7 +93,12 @@ public function onFormProcessed(Event $event)
$filename = ROOT_DIR . $fileValues['path'];
}

$message->attach(\Swift_Attachment::fromPath($filename));
try {
$message->attach(\Swift_Attachment::fromPath($filename));
} catch (\Exception $e) {
// Log any issues
$grav['log']->error($e->getMessage());
}
}
}
}
Expand Down

0 comments on commit eda7415

Please sign in to comment.