Drupal 7.9

The from domain of the password recovery email is not the domain that the user requested the password recovery from

Steps to reproduce the problem
1. Create two domains: domain.com (default) and test.domain.com
2. Create a CNAME domain record for test.domain.com pointing to another domain e.g. test-domain-com-1807680335.us-east-1.elb.amazonaws.com
3. Assign a user to test.domain.com only
4. Have user navigate to http://test.domain.com/user/password, enter username and submit
5. The user receives an email. The domain of the from email address is the domain that the CNAME points to (test-domain-com-1807680335.us-east-1.elb.amazonaws.com), not the domain name that the user is assigned to or that the user requested the password reset from (test.domain.com)

admin/structure/domain/view/56/config
Domain: test.domain.com
The email address under the site configuration is set to webmaster@test.domain.com however this doesn't seem to get used.

Background
The site is hosted on Amazon EC2. In order to get multiple ssl sites running on a single EC2 host we use the ELB service which results in the DNS setup described above.

Comments

agentrickard’s picture

Status: Active » Postponed (maintainer needs more info)

This sounds like the same problem as #1440110: Incorrect domain in one-time-login-url for password recovery.

When you say "used", please explain in what way.

agentrickard’s picture

This should, as with the other issue, be using the 'site_mail' value from the domain which sent the email message.

See http://api.drupal.org/api/drupal/includes!mail.inc/function/drupal_mail/7 and http://api.drupal.org/api/drupal/modules!user!user.module/function/_user...

The relevant code is:

$default_from = variable_get('site_mail', ini_get('sendmail_from'));

It sounds like it's reading the 'sendmail_from' value.

kjcsb’s picture

I've performed some further testing

1. Create a CNAME domain record for domain.com pointing to another domain e.g. test-domain-com-1807680335.us-east-1.elb.amazonaws.com
2. Have user navigate to http://domain.com/user/password, enter username and submit
3. The user receives an email. The domain of the from email address is the domain that the user requested the password reset from (domain.com)

So
1. If the password request form is accessed via test.domain.com the from domain is test-domain-com-1807680335.us-east-1.elb.amazonaws.com (I would expect test.domain.com)
2. If the password request form is accessed via domain.com the from domain is domain.com (as expected)

So it seems that in the standard setup (i.e. without non domain access) the from domain on the email is correct with this configuration.

The code ("$default_from = variable_get('site_mail', ini_get('sendmail_from'));") seems to get the from address from the site setup. That is set to webmaster@test.domain.com in the domain access module but it doesn't seem to get used. So is the sendmail_from not being exposed properly?

agentrickard’s picture

Status: Postponed (maintainer needs more info) » Active

This sounds like a DNS problem -- you think you are on text.example.com but really aren't. If you enable the provided "server information" block, what domain does it say you are on?

kjcsb’s picture

I enabled the "server information" block, which reported the following:

Property Value
HTTP_HOST request test.domain.com
Domain match TRUE
domain_id 56
subdomain test.domain.com
sitename test console
scheme http
valid 1
weight 1
is_default 0
machine_name test_domain_com
path http://test.domain.com/
site_grant TRUE
agentrickard’s picture

So that checks out.

agentrickard’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)