Skip to content

Commit

Permalink
Added email subject field
Browse files Browse the repository at this point in the history
  • Loading branch information
janhenckens committed Jul 11, 2024
1 parent 87a6238 commit 382d5b8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 4.2.0 - Unreleased
### Added
- Added support for exporting Users by user group
- Added a field to customize the email subject per export

## 4.1.2 - 2024-06-10
### Fixed
- Don't show "unsupported field" warning for Formie's "Heading" field
Expand Down
2 changes: 1 addition & 1 deletion src/services/MailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function send(ExportElement $export, $path): bool
$name = $exportSettings['fileName'] ?? "Export";
$fileName = "{$name}.{$exportSettings['fileType']}";
$message->attach($path, ['fileName' => $fileName, 'contentType' => "application/{$exportSettings['fileType']}"]);
$message->setSubject("Your export");
$message->setSubject($exportSettings['emailSubject'] ?? 'Your export');
$message->setTo($exportSettings['email']);
$message->setHtmlBody($html);

Expand Down
11 changes: 10 additions & 1 deletion src/templates/sprig/run.twig
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@

{{ hiddenInput('settings[deliveryType]', 'email') }}
{{ forms.textField({
first: true,
label: "Email address?"|t('exporter'),
instructions: "Your export will be delivered by e-mail. Who should receive that e-mail?<br> To enter more than one address, seperate the with a comma."|t('exporter'),
id: 'email',
Expand All @@ -143,6 +142,16 @@
errors: (errors is defined and errors.email ) ? errors.email : null,
required: true
}) }}

{{ forms.textField({
label: "Email subject"|t('exporter'),
instructions: "The subject that should be used for the email that contains your export"|t('exporter'),
id: 'emailSubject',
name: 'settings[emailSubject]',
value: settings.emailSubject ?? 'Your export',
errors: (errors is defined and errors.emailSubject ) ? errors.emailSubject : null,
required: true
}) }}
<div class="field">
<button type="submit" class="btn submit">{{ "Start export" }}</button>
</div>
Expand Down

0 comments on commit 382d5b8

Please sign in to comment.