# Email does not work; Net::SMTPAuthenticationError

**URL:** <https://meta.discourse.org/t/email-does-not-work-net-smtpauthenticationerror/317828>\
**Category:** Self-hosting\
**Tags:** email\
**Created:** [July 23, 2024, 12:48pm UTC](https://meta.discourse.org/t/email-does-not-work-net-smtpauthenticationerror/317828 "2024-07-23T12:48:44Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![wal](https://avatars.discourse-cdn.com/v4/letter/w/d6d6ee/32.png) [@wal](https://meta.discourse.org/u/wal)\
**Post date:** [July 23, 2024, 8:32pm UTC](https://meta.discourse.org/t/email-does-not-work-net-smtpauthenticationerror/317828/6 "2024-07-23T20:32:15Z")

</div>

> [@supermathie](#):
>
> I’d wager `DISCOURSE_SMTP_USER_NAME` is incorrect - `mail` is probably not enough for mailgun to authenticate you.

I just realized this as well, when I tested with `telnet` I used “[mail@mg.mydomain.com](mailto:mail@mg.mydomain.com)” as the username and it worked, so I will try it again with that as the `DISCOURSE_SMTP_USER_NAME`

> I’d guess you think `DISCOURSE_SMTP_DOMAIN` is the domain of the user? It’s not - it’s the EHLO domain. You probably don’t need to set it.

not sure I follow what this means

for MailGun I was using `mg.mydomain.com`, for Discourse I was using `discourse.mydomain.com`. I dont actually have any DNS records set at the moment for `mydomain.com`, only for the Discourse subdomain and the TXT records for the MailGun DNS

---

_[View the full topic](https://meta.discourse.org/t/email-does-not-work-net-smtpauthenticationerror/317828)._
