I am configuring a tokenized email using the Rules Module to send to the email that's listed under site settings for any given sub domain and am trying to determine if there is a token available for that.
My use case is if a user creates content on subdomain1.example.com I only want to send the tokenized email to the admin email listed under /admin/build/domain/conf/[domian ID] (for only this sub domain email).
Or is there a better way to do this by perhaps using some conditionals in my Rule. Thanks.
Comments
Comment #1
agentrickardThat value should be domain sensitive -- that is, it should read the variable for the domain that is sending the mail. So I suspect the answer depends on what rules/conditions are used to trigger the email.
Note that hook_domaincron() can be used to force cron tasks to run for each domain.
Comment #2
danny englanderHi thanks, I was hoping for a token such as
[site-mail]that could be put in for the recipient in my rule instead of hard coding an email address. I tried that though and got an error.Comment #3
agentrickardWhat error?
My understanding is that default tokens like [site-mail] should pull from variable_get(), which is domain-sensitive if using Domain Conf. If they don't, you would need to write your own tokens.
Comment #4
danny englanderI looked up the error in the log and it was:
Error sending e-mail (from webadmin@example.com to [site-mail]).-- so it looks like I will need to somehow create my own token (not my forte) as the one I thought would work was not recognized. I just saw there is a Custom tokens module for Drupal 6 so I may have a look at that. Thanks for your help as always.
Comment #5
agentrickardComment #6
danny englanderFWW, It looks like this is related to this issue which i just stumbled upon. http://drupal.org/node/932460
I was subsequently able to get this to work using Actions and Triggers as Global tokens are available there.
Comment #7
pbeakley commentedI've got the same question. Here's what I've got:
* A multi-domain website
* A manager role that has editing rights to all the domains
* A content type that is only ever assigned to one domain (it's a medical billing office, and they manage the billing for several different companies, each company with its own domain name)
So I've got a Rule that sends an email to certain referenced users when a node is published or deleted, and right now it comes from the default site email -- that is, the central domain into which the managers log. However, what I really want it to do is be able to reference the domain to which the node is published, and pull *that* domain's site address.
I've been scratching my head for hours on how to pull that off, because the tokens simply don't exist for it. I can't even send the domain_id as a variable to a View, as far as I can tell. That variable isn't available via Rules, and I have no idea how to write the PHP for a custom token.
Comment #8
danny englander@pbeakley -- Have a look at my comment #6 above and the issue I link to, it really sums up the issue we are having and at the moment, my solution is to use actions and triggers as global tokens are available for those.
Comment #9
pbeakley commented@Highrockmedia: I didn't see a "site email associated with a specific domain" type token under actions/triggers. Is this something made available through other modules?
Comment #10
danny englander@pbeakley -- you don't need a specific domain token as you set "site email" on a domain basis so therefore if you use a site email token, it will pickup whatever email was set for any given domain at
/admin/build/domain/conf/[domain id]so the issue was that the site email token was not avaibale in rules although it looks like there are some patches starting to happen over there now. Does that make sense? If not I can elaborate. -- DannyComment #11
pbeakley commentedI am following the patches over in that other thread and hope that that's where my solution will end up, Danny. What I'm not following is how to tell Actions or Triggers (or Rules or Views, for that matter) to use the "site email" that is association with a particular domain ID. I'm at a complete loss in all cases in how to do that.
I even tried writing a Rule that would run a View that fed the node's domain ID as an argument, but there doesn't appear to be a domain ID token available in Rules, at least. But that's for another issue! :-) -- Paul
Comment #12
danny englander@pbeakley - I think in basic terms, if you configure an action to use the token,
[site-mail]that will pick up whatever email has been chosen for any given domain. In other words you can have different site emails for different domains and[site-mail]picks up whatever one is contextual for the domain a user is interacting with. Hopefully,[site-mail]will now be available in rules with the new patch to send a tokenized email to the email set for any given domain.Comment #13
danny englander@pbeakley Just realized that it sounds like you are having more of an issue actually configuring a tokenized email even without the domain issue? If that's the case, I may be able to help you further with that.
Comment #14
pbeakley commentedNo no, I've got lots of tokenized emails going out. Not the issue. Let me start over.
I've got mysite.com, which is domain_id 0 and the default go-to login for my "manager" users.
Those "managers" have the ability to create a node and then assign those nodes to mysite2.com, mysite3.com and so on. (In the actual application, each domain is a separate office.)
Then I have a role called "tech." A tech is assigned to only one office/domain. That tech has editing rights to the nodes created by the "managers," (but only to nodes assigned to their office!) mostly to add things to empty fields and manually update their workflow status --> node created, node assigned to a tech, node ready for review, node ready for billing, node closed.
At various points in the workflow, Rules kick in to spit out a tokenized email. If a node is deleted, the tech receives an email. When a node moves to "ready for review," another kind of user is alerted via tokenized email.
The problem is this:
The Manager role has access to all domains and can arbitrarily assign a node to any domain. The manager also manages all these nodes while logged into mysite.com, the default domain. (The techs don't even *know* the default exists, by design -- their entire user experience is based around their own office's domain). So when the manager does something to trigger the Rule that generates an email, she's logged in to mysite.com. Therefore, the [site-address] is coming from manager@mysite.com.
What I want to have happen is that when the manager, say, deletes a node assigned to mysite2.com, the Rule spits out a tokenized email from manager@mysite2.com. Right now, the manager needs to be logged in to mysite2.com for it to pull the site default email from mysite2.com. But I really don't want to make my manager switch domains every time she touches a node.
Is that any clearer? I'd LOVE to get some additional eyeballs on this. Thanks for reading! :-) -- Paul
Comment #15
Anonymous (not verified) commentedHi,
I've exactly the same problem...
It seems like the mail you set up under the config tab of the domain X or Y is not saved or used when Drupal sends a mail using the administrative mail...
How can it be solved?