/ is a valid character for an SMTP username, according to RFC3696:
Without quotes, local-parts may consist of any combination of
alphabetic characters, digits, or any of the special characters
! # $ % & ' * + - / = ? ^ _ ` . { | } ~
Corrective path
The script fails on a sed command that, by default, uses / as the separator.
Since the colon (:) is not an acceptable character for the local-part of an email address, it may be used instead of /, without any side-effect another character such as a comma or semi-colon could bring (except that colons in the sed patterns must be escaped — note that using ] instead would remove the need to escape colons):
line 589: smtp_domain=$(echo $notification_email | sed -e "s/.*@//") should be smtp_domain=$(echo $notification_email | sed -e "s:.*@::")
line 648: DISCOURSE_DEVELOPER_EMAILS uses , to separate email addresses, so it could safely use : as well
line 675 is the source of my bug: sed -i -e "s/^ #\?DISCOURSE_SMTP_USER_NAME:.*/ DISCOURSE_SMTP_USER_NAME: $smtp_user_name/w $changelog" $web_file may be sed -i -e "s:^ #\?DISCOURSE_SMTP_USER_NAME\:.*: DISCOURSE_SMTP_USER_NAME\: $smtp_user_name:w $changelog" $web_file or sed -i -e "s]^ #\?DISCOURSE_SMTP_USER_NAME:.*] DISCOURSE_SMTP_USER_NAME: $smtp_user_name]w $changelog" $web_file
I’m not in control of that code, but I wrote it long ago. That’s a great solution. I should have thought of that. I’d guess that a PR would be welcome.
Unfortunately I lost access to my Github account. They ask me for some code and I don’t use the linked email anymore, so I simply stopped using that platform except to clone public code.