# Minor glitch in discourse-setup

**URL:** https://meta.discourse.org/t/minor-glitch-in-discourse-setup/77133
**Category:** Bug
**Created:** [02.Январь.2018 21:17:43 UTC](https://meta.discourse.org/t/minor-glitch-in-discourse-setup/77133 "2018-01-02T21:17:43Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [02.Январь.2018 21:17:43 UTC](https://meta.discourse.org/t/minor-glitch-in-discourse-setup/77133/1 "2018-01-02T21:17:43Z")

</div>

I noticed that when you run `./discourse-setup` again after an initial run, it seems to remember the values entered during the previous run (i.e. email addresses, smtp password etc). But it does not remember the SMTP user name, worse even, it remembers it wrongly.

It neither suggests the value that is actually in the app.yml nor does it resort to the default value (`postmaster@discourse.example.com`). Instead it seems to construct the suggested address by combining `postmaster@` with the forum’s domain (I think).

If your mail domain and your forum domain are the same, there is no problem. But it’s not uncommon to use a specific mail domain for mailgun & co, e.g. `mail.mydomain.com`. The correct SMTP username in that case is `postmaster@mail.mydomain.com` (and that is what it says in the app.yml file. But the setup will use `postmaster@mydomain.com` if your forum is at `mydomain.com`. (Not sure if it will use `postmaster@forum.mydomain.com` if the forum is at `forum.mydomain.com`, but either way it would be wrong.)

---

<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: [02.Январь.2018 22:21:17 UTC](https://meta.discourse.org/t/minor-glitch-in-discourse-setup/77133/2 "2018-01-02T22:21:17Z")

</div>

Should it be working this way @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: [02.Январь.2018 22:23:53 UTC](https://meta.discourse.org/t/minor-glitch-in-discourse-setup/77133/3 "2018-01-02T22:23:53Z")

</div>

Hmm. That’s not what’s supposed to happen.

I’m not sure if I broke it recently or if you’ve hit an edge case.

It **is** supposed to suggest postmaster@forum if the smtp post is mailgun. Are you using mailgun and have something other than postmaster@forum for your username?

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [02.Январь.2018 23:12:08 UTC](https://meta.discourse.org/t/minor-glitch-in-discourse-setup/77133/4 "2018-01-02T23:12:08Z")

</div>

Does the setup script work differently, depending on which email provider I use? I was assuming that it merely reads the values from an existing app.yml and suggests them as default. The clearest indication for this was when I changed the smtp port manually in the file and when I then ran setup again, it had that port as default.

Anyway, to answer your question:

> [@pfaffman](#):
>
> Are you using mailgun and have something other than postmaster@forum for your username?

Yes, I am using mailgun and my username is postmaster@mail.mydomain. Plus, and that might be the crucial point, my forum is at mydomain, not forum.mydomain

---

<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: [02.Январь.2018 23:58:27 UTC](https://meta.discourse.org/t/minor-glitch-in-discourse-setup/77133/5 "2018-01-02T23:58:27Z")

</div>

> [@tophee](#):
>
> Does the setup script work differently, depending on which email provider I use?

Why, yes. Indeed it does for a few providers where the username is predictable.

> [@tophee](#):
>
> Yes, I am using mailgun and my username is postmaster@mail.mydomain

Then why were you not amazed at how it **knew your username**!! 😉

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [03.Январь.2018 16:12:00 UTC](https://meta.discourse.org/t/minor-glitch-in-discourse-setup/77133/6 "2018-01-03T16:12:00Z")

</div>

> [@pfaffman](#):
>
> Then why were you not amazed at how it knew your username!!

Well, it didn’t. It suggested postmaster@mydomain, which I thought was a good default guess, didn’t think it was specific to mailgun.

So if I now understand how the script works, I’d like to suggest that it guesses the username only the first time and otherwise uses what it finds in the app. yml.

---

<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: [03.Январь.2018 16:38:32 UTC](https://meta.discourse.org/t/minor-glitch-in-discourse-setup/77133/7 "2018-01-03T16:38:32Z")

</div>

I see, so you have a non-standard smtp username for mailgun, and my “clever” script appears to always apply its “you’re using mailgun, so I know your username” logic. And it shouldn’t since you’re not using the mailgun default.

I’m pretty sure that this is an edge case and not a regression introduced by a recent commit. I’ll add this to my list. I’m traveling this week, so I won’t pretend that I’ll get to this until then.

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [04.Январь.2018 16:24:35 UTC](https://meta.discourse.org/t/minor-glitch-in-discourse-setup/77133/8 "2018-01-04T16:24:35Z")

</div>

> [@pfaffman](#):
>
> so you have a non-standard smtp username

Well, it depends on what you mean by non-standard. I have not chosen a different username than what mailgun gave me. So it’s completely standard in that sense. The only way it might be non standard is that my mail subdomain is not the same as my forum.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [04.Январь.2018 17:42:42 UTC](https://meta.discourse.org/t/minor-glitch-in-discourse-setup/77133/9 "2018-01-04T17:42:42Z")

</div>

Just to add up, I’d like to mention that not all providers will let Your mails deliver to their inbox if sent from a domain other than the one on which discourse is hosted.

I had a conversation with mailgun support when I was having issues in deliverability (i was using mail.mydomain.tld instead of forum.mydomain.tld) and that was the reason why my mails from discourse (which obviously are noreply@forum.mydomain.tld) were being flagged as spam so that’s not really ideal.

---

<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: [05.Январь.2018 14:39:38 UTC](https://meta.discourse.org/t/minor-glitch-in-discourse-setup/77133/10 "2018-01-05T14:39:38Z")

</div>

This guess-the-username logic has been in discourse-setup from its genesis.

Yeah, I consider having the mail domain and discourse domain different to be non standard. You have to edit the config file by hand to switch the sending address, so discourse-setup can’t help those people. I’ll have a look to see if there’s an easy way to fix this, but if seems like an edge case that may not fit.

What were you trying to accomplish?

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [05.Январь.2018 16:53:37 UTC](https://meta.discourse.org/t/minor-glitch-in-discourse-setup/77133/11 "2018-01-05T16:53:37Z")

</div>

> [@pfaffman](#):
>
> What were you trying to accomplish?

It’s not about me. I just thought that the script didn’t behave as expected because it read some values from the app.yml but not others, and I wanted to point that out. I now understand that “it’s a feature, not a bug” but I still think that when it runs a second time, it should propose the existing values.

---

<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: [26.Июнь.2018 07:38:50 UTC](https://meta.discourse.org/t/minor-glitch-in-discourse-setup/77133/12 "2018-06-26T07:38:50Z")

</div>


