Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.

Add HTML capability to E-Mail text #231

Merged
merged 3 commits into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions api/sendPic.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,21 @@
$mail->Subject = $config['mail']['subject'];

// Email body content
$mailContent = $config['mail']['text'];
$mail->isHTML( $config['mail']['is_html'] );
if ($config['mail']['is_html']) {
if (isset($config['mail']['alt_text']) && empty($config['mail']['alt_text'])) {
$mail->msgHTML($config['mail']['text']);
} else {
$mail->Body = $config['mail']['text'];
$mail->AltBody = $config['mail']['alt_text'];
}
} else {
$mail->Body = $config['mail']['text'];
}

// for send an attachment
$path = $config['foldersAbs']['images'] . DIRECTORY_SEPARATOR;

$mail->Body = $mailContent;
if (!$mail->addAttachment($path . $postImage)) {
die(
json_encode([
Expand Down
2 changes: 2 additions & 0 deletions config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@
$config['mail']['send_all_later'] = false;
$config['mail']['subject'] = null; // if empty, default translation is used
$config['mail']['text'] = null; // if empty, default translation is used
$config['mail']['alt_text'] = null; // if empty, default translation is used
$config['mail']['is_html'] = false;
$config['mail']['host'] = 'smtp.example.com';
$config['mail']['username'] = '[email protected]';
$config['mail']['password'] = 'yourpassword';
Expand Down
13 changes: 13 additions & 0 deletions lib/configsetup.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,19 @@
'name' => 'mail[text]',
'value' => htmlentities($config['mail']['text']),
],
'mail_alt_text' => [
'view' => 'advanced',
'type' => 'input',
'placeholder' => '',
'name' => 'mail[alt_text]',
'value' => htmlentities($config['mail']['alt_text']),
],
'mail_is_html' => [
'view' => 'advanced',
'type' => 'checkbox',
'name' => 'mail[is_html]',
'value' => $config['mail']['is_html'],
],
'mail_host' => [
'view' => 'basic',
'type' => 'input',
Expand Down
4 changes: 4 additions & 0 deletions resources/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@
"mail:mail_fromAddress": "Absende Adresse",
"mail:mail_fromName": "Absender Name",
"mail:mail_host": "E-Mail Host Adresse",
"mail:mail_is_html": "HTML E-Mail",
"mail:mail_password": "Passwort",
"mail:mail_port": "Port",
"mail:mail_secure": "Sicherheit (tls oder ssl)",
"mail:mail_send_all_later": "Eingegebene Email-Adressen in Datei speichern",
"mail:mail_subject": "Betreff",
"mail:mail_text": "Text",
"mail:mail_alt_text": "Alternativer Text",
"mail:mail_username": "Benutzername des E-Mail Accounts",
"mailError": "Fehler beim Senden der E-Mail",
"mailSaved": "E-Mail-Adresse erfolgreich gespeichert",
Expand Down Expand Up @@ -278,12 +280,14 @@
"manual:mail:mail_fromAddress": "Geben Sie Ihre Absenderadresse ein, die beim Senden von Bildern per E-Mail verwendet wird.",
"manual:mail:mail_fromName": "Geben Sie Ihren Absendernamen ein, der beim Senden von Bildern per E-Mail verwendet wird.",
"manual:mail:mail_host": "Geben Sie Ihre E-Mail-Host-Adresse ein.",
"manual:mail:mail_is_html": "Wenn diese Option aktiviert ist, unterstützt das Mail-Text-Feld HTML-Formatierungs- und semantische Markup-Funktionen.",
"manual:mail:mail_password": "Geben Sie Ihr Passwort ein, mit dem Sie sich in Ihr E-Mail-Konto einloggen.",
"manual:mail:mail_port": "Geben Sie den Port ein, über den E-Mails gesendet werden.",
"manual:mail:mail_secure": "Geben Sie das Protokoll ein, welches für die Transportverschlüsselung zwischen dem E-Mail-Client und dem Mailserver verwendet werden soll (SSL oder TLS).",
"manual:mail:mail_send_all_later": "Wenn diese Option aktiviert ist, werden eingegebene E-Mail-Adressen in einer Datenbank gespeichert anstatt das ausgewählte Bild direkt zu versenden. Dies kann beispielsweise verwendet werden, um nach einer Veranstaltung eine E-Mail mit allen Bildern oder einen Link zu einer Online-Galerie zu senden.",
"manual:mail:mail_subject": "Geben Sie den Betreff ein, der beim Senden von Bildern per E-Mail verwendet wird.",
"manual:mail:mail_text": "Geben Sie den Mail-Text ein, der beim Senden von Bildern per E-Mail verwendet wird.",
"manual:mail:mail_alt_text": "Wenn die Option HTML-E-Mail aktiviert ist, wird der Inhalt dieses Feldes dann zum Mail-Text, wenn der E-Mail-Client des Empfängers keine HTML-E-Mails anzeigen kann.",
"manual:mail:mail_username": "Geben Sie den Benutzernamen ein, mit dem Sie sich in Ihrem E-Mail-Konto anmelden.",
"manual:pictures:filters_defaults": "Wählen Sie einen Bildfilter, der standardmäßig nach der Aufnahme angewendet wird.",
"manual:pictures:filters_disabled": "Wählen Sie Filter aus, die aus den verfügbaren Bildfiltern entfernt werden.",
Expand Down
4 changes: 4 additions & 0 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,14 @@
"mail:mail_fromAddress": "Return address",
"mail:mail_fromName": "Sender name",
"mail:mail_host": "E-mail host adress",
"mail:mail_is_html": "HTML E-Mail",
"mail:mail_password": "Password",
"mail:mail_port": "Port",
"mail:mail_secure": "Security (tls or ssl)",
"mail:mail_send_all_later": "Store email addresses in file",
"mail:mail_subject": "Subject",
"mail:mail_text": "Text",
"mail:mail_alt_text": "Alternative text",
"mail:mail_username": "Username of the e-mail account",
"mailError": "Error sending e-mail",
"mailSaved": "E-mail address saved successfully",
Expand Down Expand Up @@ -280,12 +282,14 @@
"manual:mail:mail_fromAddress": "Enter your return address which is used while sending pictures via email.",
"manual:mail:mail_fromName": "Enter your sender name which is used while sending pictures via email.",
"manual:mail:mail_host": "Enter your email host address.",
"manual:mail:mail_is_html": "If enabled, the mail text field supports HTML formatting and semantic markup capabilities.",
"manual:mail:mail_password": "Enter your password used to login into your email account.",
"manual:mail:mail_port": "Enter the port used for email.",
"manual:mail:mail_secure": "Enter the protocol used for the transport encryption between the email client and the mail server (ssl or tls).",
"manual:mail:mail_send_all_later": "If enabled, entered email adresses get stored inside a database instead sending choosed picture directly. For example, this can be used to send a mail with all pictures or a link to an online gallery after the event.",
"manual:mail:mail_subject": "Enter the subject used while sending pictures via email.",
"manual:mail:mail_text": "Enter the mail text which is used while sending pictures via email.",
"manual:mail:mail_alt_text": "If the HTML e-mail option is enabled, the content of this field will become the mail text if the email client of the receiver cannot display HTML emails.",
"manual:mail:mail_username": "Enter the username used to login into your email account.",
"manual:pictures:filters_defaults": "Choose an image filter which is applied by default after taking a picture.",
"manual:pictures:filters_disabled": "Choose filters which get removed from the available image filters.",
Expand Down