mirror of
https://github.com/YunoHost-Apps/paheko_ynh.git
synced 2024-09-03 19:56:22 +02:00
add in config panel avalaibity to disable emails
This commit is contained in:
parent
2a72438e84
commit
f6d58358ef
4 changed files with 17 additions and 8 deletions
|
@ -498,7 +498,7 @@ const USE_CRON = true;
|
|||
* @var bool
|
||||
*/
|
||||
|
||||
//const DISABLE_EMAIL = false;
|
||||
const DISABLE_EMAIL = __DISABLE_EMAIL__;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,29 +20,34 @@ name.fr = "Configuration SMTP"
|
|||
|
||||
optional = false
|
||||
|
||||
[main.smtp.disable_email]
|
||||
ask.fr = "Désactiver l'envoi des mails (non par défaut)"
|
||||
type = "boolean"
|
||||
bind = "DISABLE_EMAIL:__INSTALL_DIR__/config.local.php"
|
||||
|
||||
[main.smtp.smtp_host]
|
||||
ask = "Host"
|
||||
ask.fr = "Serveur SMTP"
|
||||
type = "string"
|
||||
bind = "SMTP_HOST:__INSTALL_DIR__/config.local.php"
|
||||
|
||||
[main.smtp.smtp_port]
|
||||
ask = "Port"
|
||||
ask.fr = "Port"
|
||||
min = 25
|
||||
type = "number"
|
||||
bind = "SMTP_PORT:__INSTALL_DIR__/config.local.php"
|
||||
|
||||
[main.smtp.smtp_user]
|
||||
ask = "User"
|
||||
ask.fr = "Nom d'utilisateur"
|
||||
type = "string"
|
||||
bind = "SMTP_USER:__INSTALL_DIR__/config.local.php"
|
||||
|
||||
[main.smtp.smtp_password]
|
||||
ask = "Password"
|
||||
ask.fr = "Mot de passe"
|
||||
type = "password"
|
||||
bind = "SMTP_PASSWORD:__INSTALL_DIR__/config.local.php"
|
||||
|
||||
[main.smtp.smtp_security]
|
||||
ask = "Security"
|
||||
ask.fr = "Sécurité de la connexion"
|
||||
type = "string"
|
||||
choices.NONE = "NONE, pas de chiffrement"
|
||||
choices.SSL = "SSL, connexion SSL native"
|
||||
|
@ -51,11 +56,11 @@ name.fr = "Configuration SMTP"
|
|||
bind = "SMTP_SECURITY:__INSTALL_DIR__/config.local.php"
|
||||
|
||||
[main.smtp.mail_return_path]
|
||||
ask = "Adresse e-mail destinée à recevoir les erreurs de mail"
|
||||
ask.fr = "Adresse e-mail destinée à recevoir les erreurs de mail"
|
||||
type = "string"
|
||||
bind = "MAIL_RETURN_PATH:__INSTALL_DIR__/config.local.php"
|
||||
|
||||
[main.smtp.mail_sender]
|
||||
ask = "Adresse e-mail expéditrice des messages"
|
||||
ask.fr = "Adresse e-mail expéditrice des messages"
|
||||
type = "string"
|
||||
bind = "MAIL_SENDER:__INSTALL_DIR__/config.local.php"
|
||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
secret_key=$(ynh_string_random --length=50)
|
||||
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
|
||||
|
||||
ynh_app_setting_set --app=$app --key=smtp_disable_email --value=0
|
||||
ynh_app_setting_set --app=$app --key=smtp_host --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=smtp_port --value=25
|
||||
ynh_app_setting_set --app=$app --key=smtp_user --value=$app
|
||||
|
|
|
@ -32,6 +32,7 @@ fi
|
|||
if [ -z "${smtp_host:-}" ]; then
|
||||
user_conf="$data_dir/data/config.local.user.php"
|
||||
if [ -f $user_conf ]; then
|
||||
disable_email=$(ynh_read_var_in_file --file=$user_conf --key=DISABLE_EMAIL)
|
||||
smtp_host=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_HOST)
|
||||
smtp_port=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_PORT)
|
||||
smtp_user=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_USER)
|
||||
|
@ -42,6 +43,7 @@ if [ -z "${smtp_host:-}" ]; then
|
|||
ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf
|
||||
ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf
|
||||
else
|
||||
disable_email=0
|
||||
smtp_host=$domain
|
||||
smtp_port=25
|
||||
smtp_user=$app
|
||||
|
@ -50,6 +52,7 @@ if [ -z "${smtp_host:-}" ]; then
|
|||
mail_return_path=$app@$domain
|
||||
mail_sender=$app@$domain
|
||||
fi
|
||||
ynh_app_setting_set --app=$app --key=disable_email --value=$disable_email
|
||||
ynh_app_setting_set --app=$app --key=smtp_host --value=$smtp_host
|
||||
ynh_app_setting_set --app=$app --key=smtp_port --value=$smtp_port
|
||||
ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user
|
||||
|
|
Loading…
Add table
Reference in a new issue