Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I have the latest version installed and am trying to set-up the sending of a tokenized email when someone either subscribes or unsubscribes to a newsletter.
The email is being sent, but the token fields are coming through unpopulated - eg [simplenews-receiver-mail] is showing up as [simplenews-receiver-mail] in the email.
Global tokens appear ok in the email.
Am I trying to use the tokens for a use they weren't intended for?
Comments
Comment #1
Sutharsan CreditAttribution: Sutharsan commentedThe tokens are supported only in the simplenews (un)subscribe confirmation emails. Not in other emails e.g. Sent by Actions or Rules. Are all simplenews tokens not replaced?
Comment #2
linksync CreditAttribution: linksync commentedoh, ok Sutharsan. Tokens are working fine in the simplenews (un)subscribe confirmation emails. I was trying to use them in actions.
A few of my client want an email sent to them any time a user (un)subscribes to their sites newsletters (including the email address of the (un)subscriber) and I was hoping I could do that with actions and tokens.
Could I modify the function to bcc a message to her when a user (un)subscribes? If so, what function should I be looking at, or is there another way I can achieve this?
Thanks.
Comment #3
Sutharsan CreditAttribution: Sutharsan commentedA small module with a hook_mail_alter implementation will do just that.
Comment #4
tajabosc CreditAttribution: tajabosc commentedHello,
i followed your advice to use a hook_mail_alter approach.
In this way i get almost all simplenews tokens working in mails sent with "actions", but i can't get [simplenews-receiver-mail] token for anonymous users.
I checked
$account->mail
, and is in fact emptyI wonder if i can get the equivalent of
%user
prompted indrupal_set_message
in the mails sent trough actions...Is there any way to get the email address of the anonymous newsletter receiver?
Regards
Daniele
Comment #5
imadrupal CreditAttribution: imadrupal commentedWhere do i put this code ?