Skip to content

Commit

Permalink
refactor: Make 'From name' customizable
Browse files Browse the repository at this point in the history
  • Loading branch information
ammopt committed Jun 20, 2024
1 parent abf2b2f commit 904c783
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions code/web/sys/DBMaintenance/version_updates/24.07.00.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function getUpdates24_07_00(): array {
port int(11) NOT NULL DEFAULT 25,
ssl_mode enum('disabled','ssl','tls') NOT NULL,
from_address varchar(80) DEFAULT NULL,
from_name varchar(80) DEFAULT NULL,
user_name varchar(80) DEFAULT NULL,
password varchar(80) DEFAULT NULL,
PRIMARY KEY (`id`)
Expand Down
12 changes: 10 additions & 2 deletions code/web/sys/Email/SMTPSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class SMTPSetting extends DataObject {
public $port;
public $ssl_mode;
public $from_address;
public $from_name;
public $user_name;
public $password;

Expand Down Expand Up @@ -60,11 +61,18 @@ public static function getObjectStructure($context = ''): array {
'from_address' => [
'property' => 'from_address',
'type' => 'text',
'label' => 'From',
'label' => '\'From\' address',
'description' => 'The \'From:\' e-mail address',
'default' => '',
'required' => true,
],
'from_name' => [
'property' => 'from_name',
'type' => 'text',
'label' => '\'From\' name',
'description' => 'The \'From:\' name',
'required' => true,
],
'user_name' => [
'property' => 'user_name',
'type' => 'text',
Expand Down Expand Up @@ -103,7 +111,7 @@ function sendEmail($to, $replyTo, $subject, $body, $htmlBody, $attachments){
}

$mail->From = $this->from_address;
$mail->FromName = 'Aspen Discovery';
$mail->FromName = $this->from_name;
$mail->addAddress($to);

for($i = 0; $i < sizeof($attachments['name']); $i++){
Expand Down
1 change: 1 addition & 0 deletions install/aspen.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4689,6 +4689,7 @@ CREATE TABLE `smtp_settings` (
`port` int(11) NOT NULL DEFAULT 25,
`ssl_mode` enum('disabled','ssl','tls') NOT NULL,
`from_address` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`from_name` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`user_name` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`password` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
PRIMARY KEY (`id`)
Expand Down

0 comments on commit 904c783

Please sign in to comment.