Skip to content

Commit f04292a

Browse files
committed
fix for email file attachments using stream
1 parent 51ec377 commit f04292a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# v4.0.4
2+
## mm/dd/2023
3+
4+
1. [](#bugfix)
5+
* Fix for email file attachments using stream
6+
17
# v4.0.3
28
## 06/29/2023
39

email.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ protected function sendFormEmail($form, $params, $vars)
125125
{
126126
// Build message
127127
$message = $this->email->buildMessage($params, $vars);
128+
$locator = $this->grav['locator'];
128129

129130
if (isset($params['attachments'])) {
130131
$filesToAttach = (array)$params['attachments'];
@@ -135,9 +136,11 @@ protected function sendFormEmail($form, $params, $vars)
135136
if (isset($fileValues['file'])) {
136137
$filename = $fileValues['file'];
137138
} else {
138-
$filename = ROOT_DIR . $fileValues['path'];
139+
$filename = $fileValues['path'];
139140
}
140141

142+
$filename = $locator->findResource($filename, true, true);
143+
141144
try {
142145
$message->attachFromPath($filename);
143146
} catch (\Exception $e) {

0 commit comments

Comments
 (0)