0

I have a couple of drupal sites running from the same host, using apache vhosts to do domain name forwarding.

I have many domains/url's dns entries pointing to this server's ip address, some of which are not currently live websites (they fail/default over to my main website).

When a user registers on one of the sites, or the site sends me an email alert, it includes a link at the bottom of the email where I can click and view the user account, etc.

The problem is, it seems the domain/url in the link changes randomly, and is not always the domain/url of the actual site it's from. They are all domains I own and are pointing at the box, so it's like drupal does a DNS lookup on itself, then uses one of the returned domains to include in the email instead of the sitename set in the settings.

How can I fix this so emails will include a link to the proper domain they originated from?

8
  • 1
    how does it 'default over'. Could it be that user goes to site A, which redirects to site B. They do something but the header still shows them originating from site A, and that's what Drupal is seeing?
    – Geoff
    Jun 27, 2014 at 2:25
  • @Geoff it appears this is indeed what is happening. Confusing because my email templates seem to be using [site:name], and the drupal instance is very much aware of it's site-name, as it's configured in admin>config>system. Seems odd it wouldn't just use that setting always.
    – SnakeDoc
    Jun 27, 2014 at 18:16
  • Indeed. As at least one of the questions has suggested, you could override that behaviour and simply hard-code your site name into the response emails.
    – Geoff
    Jun 27, 2014 at 18:19
  • @Geoff When i get out of the office i'm going to redo my apache config to do an actual redirect to my default site, instead of just having the vhost config's fail-over to a default site if no vhost matches the inbound url/domain.
    – SnakeDoc
    Jun 27, 2014 at 20:49
  • 1
    probably best - use a 301 (permanent) - makes search engines happy if the offending url will no longer be used.
    – Geoff
    Jun 27, 2014 at 21:01

2 Answers 2

1

Go to:

admin>configuration>people>account settings

Scroll down and you will see 8 email options for account activities such as account activation, password recovery, etc..

The Default token inside these emails is [site:name] which I presume is what's giving you trouble? Or do you have it set to [site:url]?

Regardless possible next steps:

Blockquote

3
  • Hmm... I don't see an email like the one's I'm getting, however the ones in this setting seem to use [site:name], which should be what is configured under admin>config>system... so it seems weird that drupal would even attempt to use what is in the user's address bar. However, this seems to fit my experience best, so I'll need to setup apache to actually perform a forward to my base/fallback domain... instead of just serving up the base/fallback domain's web pages.
    – SnakeDoc
    Jun 27, 2014 at 18:15
  • Hmm ... what's generating the notifications? A custom module or what? It looks like whatever it is is using [site:url] Yes, the solutions 2 and 3 in the above linked article propose what you suggest: "Configure your webserver so that the default page served when an incoming request is something other than your default Drupal installation, such as an error page" OR "Configure your webserver to redirect all requests that reach your server that are not for the appropriate domain to forward to the right domain name" Jun 27, 2014 at 18:21
  • The email that prompted this question was a new-user signup requiring admin approval email notice. At the bottom of the email it provides a link to that user in the admin interface (so you can approve the account), and it came from a domain i'm not hosting but who's DNS points at the same host ip. When i get out of the office, i'm going to try fixing my apache config to just do an actual redirect instead of just failing-over to a default domain. I think that will help clear it up without having to hard-code anything in my drupal instance (easier to maintain)
    – SnakeDoc
    Jun 27, 2014 at 20:45
0

Are the e-mails being queued to get sent during a cron run instead of going out immediately? I had this problem before while using a multi-site set up. If e-mails are queued, they will be sent from whichever site runs the cron job. So they'll be addressed from that site instead of the site that put it in the queue.

1
  • I don't think so... i'm not running a multi-site drupal setup, but rather multiple drupals on a single host using vhosts to send traffic to the proper drupal instance based on url forwarding. In any regard, some of teh emails have links/urls from sites that are not hosted right now, but in DNS are pointing at the host... so it seems drupal is doing some sort of DNS query then using one of the results to include in the emails.
    – SnakeDoc
    Jun 27, 2014 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.