I need to be able to bulk send emails to recipients by selected a batch of nodes, and then somehow deriving the recipient address from a field within each node.

So selecting 10 nodes in a VBO view, then choosing the action Send an email..., it will send 10 emails, one to each of 10 email addresses... each address derived from a specified field in each of the nodes...

I can see that you can use %author as a replacement for the recipient address, but it doesn't seem to allow you to draw on any other fields as the recipient... has any body got any suggestions?

Comments

infojunkie’s picture

Token module comes with another email action called "Send tokenized e-mail" where the recipient can be based on a token, including node fields. That should do it.

colinjones’s picture

thanks kratib, again! so install VBO and Token, and Token will add a new action to VBO's list that allows me to do this?

colinjones’s picture

interesting.... it does seem to do basically what I'm looking for... however, the action itself doesn't let you configure the sender. It uses www-data and the default domain of the SMTP server. I can modify exim's default domain OK, but it still sends as www-data... problem with that is, most receiving email servers check the domain and if it is the same domain as the receiving domain (ie an "internal" email) they will often reject the email as part of their anti spam filtering....

does anyone know if there is a way of setting a "masquarade" sender within the Send Tokenised email action?

cheers!

infojunkie’s picture

The Token email action gets its sender info from the site's default email address (Site configuration > Site information), and failing that, from php.ini's "sendmail_from" attribute. Are these not set on your installation?

colinjones’s picture

kratib

The Site Conf -> Site info is definitely set, but it isn't using that. It was using www-data@red.example. The www-data presumably because it is the user running the web site, and red.example is the default domain given in the exim config file. I updated the exim default domain to something else and it uses that, but still uses the www-data user.

The sendmail_from attribute in /etc/php5/apache2/php.ini says Win32 only. For Unix it has sendmail_path but it isn't clear how you can specify the From: in this option, it just seems to be used to point at the binary. It isn't set so I'm assuming it is finding it in the path variable.

The emails that are getting through (hotmail.com doesn't seem to care about the sender stuff!) are actually being received as From: www-data@blah.com On Behalf Of where the is the address set for the Site Information...

infojunkie’s picture

I'm afraid my ability to troubleshoot the Token mail action stops here... You might want to redirect this issue to the Token maintainers.

colinjones’s picture

Project: Views Bulk Operations (VBO) » Token
Version: 6.x-1.8 » 6.x-1.12
Component: Actions » Code

Wondering if anybody can help on this one.... the action to send a tokenised email is great, but seems to be missing a couple of things. I can't set a From:/Reply To: and it doesn't seem to use the site default email address... so I get www-data@red.example (which of course gets bounced by most receiving systems). I can change the red.example in the exim conf file, but not the user name.

The other critical feature I need is attachments... is there any way to fudge this so that I can send a message body and one attachment? (like actually pasting the MIME code for the attachment at the bottom of the message body?!)

colinjones’s picture

OK, update, I realised that Exim doesn't have www-data as a "trusted_user" and therefore cannot use a sendmail -f
to change the sender address. Once I added it to the .conf file and restarted exim it now allows the correct site information address to come through.

I'm still having issues with some mail servers rejecting my emails, presumably based on spam grounds... not sure whether they are reacting to the sending IP address, sender domain or something else...

Summit’s picture

Hi,
Could rules help you? www.drupal.org/project/rules and emailfield www.drupal.org/project/email ?
I would love to see your complete solution. Because I am thinking about the same sort of functionality.

Getting nodes to be send to the users-email. But I would also be possible to select the users to send out of a sort of list..

greetings,
Martijn

colinjones’s picture

That's interesting... hmm, I've played with Rules. I have a cck stage field which can be set to Send Application Form. I built a rule that triggers on field change AND that field being set to Send App Form. Then use the Send email to arbitrary address rule, and populate cck field rule to move the stage to Application Form Sent and send an email.

That's a good work around for not being easily able to add a button to the node to trigger this manually. Thing is, even with Token, there still doesn't seem to be a way of sending an email with an attachment... any ideas there? What would happen if I embedded MIME at the bottom of the email "body"?

infojunkie’s picture

The programmatic way to add attachments is to use hook_mail_alter on the message you want to send. Check out this post for an example.

The friendly way would be to create a new action that allows files to be attached.

colinjones’s picture

kratib - thanks for the info! But well beyond my capabilities, sorry! You're right, a new action would be fantastic.

Dave Reid’s picture

Component: Code » Token Actions
Dave Reid’s picture

Status: Active » Fixed

I don't think there's anything more to discuss in this issue, so marking as fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.