diff options
author | Daniel Hansson <github@hanssonit.se> | 2020-10-03 14:06:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-03 14:06:44 +0300 |
commit | 26339d298835591e641dd3d06139ed1b542db46c (patch) | |
tree | aa63dad995e955e8ad556ee3f59f7342ecbc524b | |
parent | 7e40d30664ad90bc53ac34ce02d53630aabfdf58 (diff) | |
parent | 22bfa4d18411c2700b01349192f92b23a57849fb (diff) |
Merge pull request #1509 from nextcloud/szaimen-patch-1
-rw-r--r-- | addons/smtp-mail.sh | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/addons/smtp-mail.sh b/addons/smtp-mail.sh index 76e47f21..f056a67a 100644 --- a/addons/smtp-mail.sh +++ b/addons/smtp-mail.sh @@ -104,14 +104,14 @@ esac # Enter your SMTP username if yesno_box_yes "Does $MAIL_SERVER require any credenitals, like username and password?" then - MAIL_USERNAME=$(input_box_flow "Please enter the SMTP username to your email provider.\nE.g. you@$MAIL_SERVER") + MAIL_USERNAME=$(input_box_flow "Please enter the SMTP username to your email provider.\nE.g. you@mail.com") # Enter your mailuser password MAIL_PASSWORD=$(input_box_flow "Please enter the SMTP password to your email provider.") fi # Enter the recipient -RECIPIENT=$(input_box_flow "Please enter the recipient email address that shall receive all mails.\nE.g. recipient@$MAIL_SERVER") +RECIPIENT=$(input_box_flow "Please enter the recipient email address that shall receive all mails.\nE.g. recipient@mail.com") # Present what we gathered, if everything okay, write to files msg_box "These are the settings that will be used. Please check that everything seems correct. @@ -132,16 +132,16 @@ fi # Add the encryption settings to the file as well if [ "$PROTOCOL" = "SSL" ] then - export MSMTP_ENCRYPTION1="tls on" - export MSMTP_ENCRYPTION2="tls_starttls off" + MSMTP_ENCRYPTION1="tls on" + MSMTP_ENCRYPTION2="tls_starttls off" elif [ "$PROTOCOL" = "STARTTLS" ] then - export MSMTP_ENCRYPTION1="tls on" - export MSMTP_ENCRYPTION2="tls_starttls on" + MSMTP_ENCRYPTION1="tls on" + MSMTP_ENCRYPTION2="tls_starttls on" elif [ "$PROTOCOL" = "NO-ENCRYPTION" ] then - export MSMTP_ENCRYPTION1="tls off" - export MSMTP_ENCRYPTION2="tls_starttls off" + MSMTP_ENCRYPTION1="tls off" + MSMTP_ENCRYPTION2="tls_starttls off" fi # Check if auth should be set or not @@ -189,7 +189,7 @@ tls_trust_file /etc/ssl/certs/ca-certificates.crt account $MAIL_SERVER host $MAIL_SERVER port $SMTP_PORT -from $MAIL_USERNAME@$MAIL_SERVER +from $MAIL_USERNAME user $MAIL_USERNAME password $MAIL_PASSWORD @@ -214,7 +214,7 @@ sudo chmod 0644 $VMLOGS/mail_msmtp.log # Create aliases cat << ALIASES_CONF > /etc/aliases root: $RECIPIENT -default:$RECIPIENT +default: $RECIPIENT cron: $RECIPIENT ALIASES_CONF @@ -224,7 +224,21 @@ set sendmail="/usr/bin/msmtp -t" DEFINE_MAIL # Test sending of mails -if ! echo -e "Congratulations! Since this email reached you, it seems like everything is working properly. :) To change the settings please check /etc/msmtp on your server, or simply just run the setup script again." | mail -s "Test email from your NcVM" "$RECIPIENT" &>/dev/null +if ! echo -e "Congratulations! + +Since this email reached you, it seems like everything is working properly. :) + +To change the settings please check /etc/msmtprc on your server, or simply just run the setup script again. + +YOUR CURRENT SETTINGS: +------------------------------------------- +$(grep -v password /etc/msmtprc) +------------------------------------------- + +Best regards +The NcVM team +https://nextcloudvm.com" \ +| mail -s "Test email from your NcVM" "$RECIPIENT" &>/dev/null then # Fail message msg_box "It seems like something has failed. |