title: Django getting SMTP Server URL as URL in the password reset email
body: <p>I made a Django application with custom users.</p>
  <p>I followed the docs to create my password reset pages and forms. I found <a href="https://stackoverflow.com/questions/5812985/django-password-reset-email-subject-line-contains-example-com">this similar question</a> and tweaked my configuration to use the right domain name. My <code>SITE_ID</code> is set to 1, and I'm sure the <code>Site</code> with <code>pk=1</code> is configured to be my domain.</p>
  <p>When I try to get a password reset email, the subject contains the correct URL for the site I am requesting the password reset for. (Subject is &quot;Password reset for myMainDomain.com&quot;)</p>
  <p>The problem is the link inside the mail: the auto-generated link points to a CNAME of my <strong>mailserver</strong>, for some unknown reason. Django shouldn't even know that, since the only place I put the mailserver's domain is in the mail settings in  <code>setting.py</code></p>
  <p>My <code>users.urls.py</code>:</p>
  <pre><code>urlpatterns = [path('accounts/', include('django.contrib.auth.urls')),
                  path('', views.UserListView.as_view(), name='lista-user'),
                  path('accounts/signup/', views.Iscriviti.as_view(), name='signup'),
                  path('&lt;int:pk&gt;', views.Profilo.as_view(), name='profilo'),
                  path('accounts/edit/&lt;int:pk&gt;', views.Modifica.as_view(), name='modifica-utente')]
  </code></pre>
  <p>My template <code>password_reset_email.html</code>:</p>
  <pre><code>Here is your password-reset link:
  {{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
  </code></pre>
  <p>Relevant part of my <code>settings.py</code>:</p>
  <pre><code>EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
  EMAIL_HOST = 'mail.myMailServerdomain.it'
  EMAIL_PORT = '25'
  EMAIL_HOST_USER = 'MYUSER'
  EMAIL_HOST_PASSWORD = 'MYPASS'
  EMAIL_USE_TLS = False
  EMAIL_USE_SSL = False
  DEFAULT_FROM_EMAIL = 'noreply@myMailServerdomain.it'
  
  SITE_ID = 1 # -&gt; This is the site I configured on Django, with my_site.domain = 'myMainDomain.com' and my_site.name = 'My site's name'
  </code></pre>
  <p>The email I get when I try a password reset:</p>
  <pre><code>Here is your password-reset link:
  http://tracking.mymailserverdomain.it/f3ag34/Go6CyRfZ=0D
  </code></pre>
  <p><code>tracking.mymailserverdomain.it</code> is a CNAME of my domain <code>mymailserverdomain.it</code> which I pointed to <code>track.mail.mymailserverdomain.it</code>. I tried to send an empty mail with <code>{{domain}}</code> inside to see if my SMTP server used that for some reason, but it doesn't and just puts <code>{{domain}}</code> in the mail.</p>
  <p>How can I investigate this behavior?</p>