Discourse app.yml doesn't like email password contain "#"


(Felix) #1

I’m using discourse V1.8.0.beta5 +202

I tried my Gmail account with contain “#” and rebuild app, but couldn’t send test email at admin/email.

I changed my Gmail password without “#” and rebuild app, then send test email works fine.


(cpradio) #2

Did you read


(Jeff Atwood) #3

Yes this is mentioned in the app.yml help but you would not see it as part of the discourse-setup questions, it is true.


(Felix) #4

Sorry, I didn’t read it, tried few hours to identify the issue.

It’s hard to read the comments in app.yml due to the color in VI editor (sorry I’m new in Linux and don’t know how to change color setting in VI), can we mention this issue as part of the discouse-setup?


(Jeff Atwood) #5

Seems annoying to mention it there since it will only affect people who have # in their password. Password is put in quotes so that should work, shouldn’t it @pfaffman ?


(Jay Pfaffman) #6

I would think so, but my read of the (really, really old) linked topic is that even with single quotes it wasn’t working.

Yes. Discourse-setup puts double-quotes around the password. If pups and/or docker do the right thing with

  DISCOURSE_SMTP_PASSWORD: "hise@#ijflkjfpassword"

then it should work. N.B. that discourse-setup strips that comment about the #. If we want that comment then we need to put it on standalone.yml on the line above it.


(Jeff Atwood) #7

So this should not be an issue @felix. Did you use discourse-setup program as documented in our official setup doc?


(Felix) #8

I followed steps at Set up Discourse in the cloud in under 30 minutes which is using discourse-setup.

But I can’t remember which email ( I have two email address, one password contains “#” and another one doesn’t) was used for discourse-setup.

What I can remember is DISCOURSE_SMTP_PASSWORD: do have double-quotes around the password when I open by sudo vi app.yml. And send test email function only works if the password doesn’t contains “#”.


(Jay Pfaffman) #9

So it seems that SMTP passwords with # in them just don’t work? And ./discourse-setup should tell people that they should get a different password?


(Jeff Atwood) #10

We are not sure. I believe with double quotes around it, it should work. It should be tested.


(Jay Pfaffman) #11

I “tested” and the docker that gets called at the end of a rebuild has the SMTP password in single quotes. Like this:

'DISCOURSE_SMTP_PASSWORD=this@!#paswwored' -e 

I am not willing to contrive an actual test to see what password gets sent to an SMTP server. To recap, the OP presents evidence that it doesn’t work.

Docs say pretty clearly not to use Gmail for mail sending. The recommended services don’t (in my experience) create passwords with hashes in them. Seems like an edge case, but I can have ./discourse-setup check for hashes in passwords if @codinghorror wants.


(Jeff Atwood) #12

We can probably leave it be for now.


(Pavel Minaev) #13

It’s passed correctly to Docker if you use the quotes. The problem is that once it ends up inside discourse.conf, it’s not quoted there - and then # is interpreted as beginning of the comment for that line.

Note that this is very to trip up if you 1) use a mail service that lets you provide your own password, and 2) use a strong password generator. Just spent several days trying to figure out why mail wasn’t working on a fresh Discourse docker install, and this was the culprit.


(Mitchell Krog) #14

Passwords containing # are a problem in mySQL too. I know there are ways of fixing it but I have resorted to not using # characters in mySQL or Discourse passwords. There are other great special characters that we can use but we all seem to be addicted to # … me included :joy:


(Eli the Bearded) #15

That suggests a double quoting trick may work, eg:

DISCOURSE_SMTP_PASSWORD: "'#1passwordEVAR'"