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

**URL:** https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437
**Category:** Bug
**Created:** [3월 6, 2017, 12:12오전 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437 "2017-03-06T00:12:56Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![LiveLikeLastDay](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/livelikelastday/32/81400_2.png) [@LiveLikeLastDay](https://meta.discourse.org/u/LiveLikeLastDay)
#### Post date: [3월 6, 2017, 12:12오전 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/1 "2017-03-06T00:12:56Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [3월 6, 2017, 12:25오전 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/2 "2017-03-06T00:25:59Z")

</div>

Did you read  
[https://meta.discourse.org/t/bug-smtp-password-field-does-not-escape-comment-sign-hash/23344/](https://meta.discourse.org/t/bug-smtp-password-field-does-not-escape-comment-sign-hash/23344/)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 6, 2017, 3:07오전 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/3 "2017-03-06T03:07:34Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![LiveLikeLastDay](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/livelikelastday/32/81400_2.png) [@LiveLikeLastDay](https://meta.discourse.org/u/LiveLikeLastDay)
#### Post date: [3월 6, 2017, 9:55오후 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/4 "2017-03-06T21:55:26Z")

</div>

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

> [@cpradio](#):
>
> Did you read
> 
> Bug: SMTP password field does not escape comment sign (hash)

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?

> [@codinghorror](#):
>
> Yes this is mentioned in the app.yml help but you would not see it as part of the discourse-setup questions,

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 6, 2017, 10:56오후 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/5 "2017-03-06T22:56:58Z")

</div>

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 ?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [3월 6, 2017, 11:25오후 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/6 "2017-03-06T23:25:45Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 6, 2017, 11:29오후 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/7 "2017-03-06T23:29:09Z")

</div>

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

---

<div class="post-metadata">

### Author: ![LiveLikeLastDay](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/livelikelastday/32/81400_2.png) [@LiveLikeLastDay](https://meta.discourse.org/u/LiveLikeLastDay)
#### Post date: [3월 8, 2017, 3:28오전 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/8 "2017-03-08T03:28:54Z")

</div>

I followed steps at[Set up Discourse in the cloud in under 30 minutes](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md) 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 “#”.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [3월 8, 2017, 4:06오후 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/9 "2017-03-08T16:06:19Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 8, 2017, 8:53오후 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/10 "2017-03-08T20:53:57Z")

</div>

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

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [3월 10, 2017, 11:31오후 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/11 "2017-03-10T23:31:52Z")

</div>

> [@codinghorror](#):
>
> I believe with double quotes around it, it should work. It should be tested.

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.

> [@LiveLikeLastDay](#):
>
> 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.

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 10, 2017, 11:48오후 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/12 "2017-03-10T23:48:16Z")

</div>

We can probably leave it be for now.

---

<div class="post-metadata">

### Author: ![int19h](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/int19h/32/71591_2.png) [@int19h](https://meta.discourse.org/u/int19h)
#### Post date: [3월 17, 2017, 8:38오전 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/13 "2017-03-17T08:38:12Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mitchellk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mitchellk/32/120419_2.png) [@mitchellk](https://meta.discourse.org/u/mitchellk)
#### Post date: [3월 17, 2017, 8:48오전 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/14 "2017-03-17T08:48:45Z")

</div>

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 😂

---

<div class="post-metadata">

### Author: ![elijah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elijah/32/104055_2.png) [@elijah](https://meta.discourse.org/u/elijah)
#### Post date: [3월 17, 2017, 6:24오후 UTC](https://meta.discourse.org/t/discourse-app-yml-doesnt-like-email-password-contain/58437/15 "2017-03-17T18:24:06Z")

</div>

> [@int19h](#):
>
> 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.

That suggests a double quoting trick may work, eg:

`DISCOURSE_SMTP_PASSWORD: "'#1passwordEVAR'"`
