I haven't found this issue anywhere else, so forgive me if i'm posting in the wrong spot or reposting a known issue.

I'm using the views send module as part of a program where we can bulk email to the relatives of users on the system. I've created a cck email field where those users can input the email address of the folks we want to send to, and i have the view pulling the field. I'm selecting it with views send, and when I run the operation and view the report, I'm seeing the field as empty. This doesn't happen when I pull from the required user email address, but any kind of cck field with an email address in it does not work. Does anyone know why this is?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hansfn’s picture

Status: Active » Postponed (maintainer needs more info)

Which module do you use for the "cck email field"?

[...] when I run the operation and view the report, I'm seeing the field as empty

What do you mean? This sounds like the email field is empty in the View itself.

PS! Maybe attach an export of your view to this issue.

markroma78’s picture

Status: Postponed (maintainer needs more info) » Active
FileSize
24.2 KB
40.02 KB

here's a couple of screenshots to help a bit.

So i've tried a few types of cck fields for this task. One was just a text field where the user could type in email@whatever.com
The next was an actual email field using the http://drupal.org/project/email (this is in the screenshot) and then just to try it, i actually edited the view stripped the html to test it and see if it worked. when looking at the screenshots, in the view, the "jestee emails" are the email fields from the user's account. the Jester emails are the cck fields they fill out. They do show in the view, and I've selected them to send. but as you see in the second screenshot of the report, the fields come through empty.

hansfn’s picture

OK, so by report you mean the log entry generated by Views Send when a message is sent by cron.

Are you sure this isn't just a problem with the logging? You see, Views Sends is validating the e-mail addresses (and empty isn't allowed). You should at least test with setting the formatting of email field to plain text - no link - in the view.

PS! Which packaging date do you have in views_send.info?

markroma78’s picture

I did in fact try to output the view as plain text and get the same result. What makes me confused is that the module WILL send emails, as long as the recipient address is pulled from the Email field for the user, but not from another cck field containing an email address. I feel like there's something simple I'm missing here.

When I use the user Email field, filter the view, and send an email and then view the logs, it actually shows each individual email address the module sent to.

the packaging date on my module is:

script on 2012-05-22
version = "6.x-1.x-dev"
core = "6.x"
project = "views_send"
datestamp = "1337648217"

hansfn’s picture

Title: views send and using an email field OTHER than the user email field » Only user email field works
Status: Active » Fixed

I finally was able to reproduce it. (I should have done it earlier.)

Fixed in commit e7c1cd6 (hopefully).

Please confirm so I can release 6.x-1.0-alpha2 (with this fix).

markroma78’s picture

I installed your new commit and still have this problem. I've tried outputting a cck field in every way I can think of. I've also tried it on a sandbox D6 installed with just cck, views send, and the required modules and still have this problem. How did you get yours to work?

hansfn’s picture

I installed your new commit and still have this problem.

Which version is that? You need to be precise. Your problem, with no validation error, but empty e-mail logged, can't happen ... Or is there a new problem?

markroma78’s picture

To clarify, I sill experience the issue with no email being sent by the module (after running cron) even with commit e7c1cd6

hansfn’s picture

OK, but does it still log with an empty e-mail address? I guess so.

Anyway, it just struck me that you might be using Views 3? If so, that could explain a lot. Views Send hasn't been tested with Views 3 (on Drupal 6). If you aren't using Views 3, you need to export your view and attach it here (as I suggested earlier). I just can't reproduce this.

markroma78’s picture

FileSize
12.91 KB

I'm using views 2.16

Attached is a txt file with my exported view in it.

Thanks!

markroma78’s picture

I wanted to check in on this and see if my exported view works all right?

hansfn’s picture

I hadn't really looked at it before now. It looks OK, but different from mine. I wonder what version of VBO you are using. (I'm using 6.x-1.13.) Maybe that is the problem ... There was a major change in VBO and Views Send doesn't work with older versions of VBO. Should have thought about that long time ago.

PS! I'll be on vacation the first two weeks of July. In case I don't see your reply before I leave.

markroma78’s picture

wow, that made a radical change (switched to VBO 1.13) Might have to re-configure the view because the email edit window disappeared. I'll post another note when my test view is working again. Good thinking!

markroma78’s picture

FileSize
37.5 KB
67.88 KB
26.02 KB

Okay, hopefully I catch you before you head out on vacation.

whenever I attempt to send a mass email (using one of my cck fields as a recipient) I get an error message now that says

"The field used for recipient's E-mail field_1atestmail_value contains 2 invalid E-mail addresses from a total of 2 selected. Choose other field to act as recipient's E-mail or narrow the selection to a subset containing only valid addresses."

The odd thing is that in my test I'm only choosing one row as my recipient (see the screenshots)

I've exported my view again as a text file so maybe you can look it over.

daveX99’s picture

Version: 6.x-1.x-dev » 6.x-1.0-alpha2

I'm experiencing the same as described in #14 above. I know php mailer is working, sending in plain text (no mime mail).

I'm not sure how to look and see the address as it is 'seen' by the code - are there extra characters in it somehow? Is the validator too aggressive, and maybe misreading the address as invalid (they look good to me...).

-dave.

markroma78’s picture

unfortunately this issue is not resolved and hasn't moved in 20 days. I would be happy to do whatever I can to help fix this module. let me know if there's anything more I can add to the discussion

hansfn’s picture

I'm still on vacation - sorry. (This module didn't "move" for a very, very long time before I stepped up to maintain it so 20 days is nothing, seriously.)

PS1! You are using the latest VBO, right?

PS2! I have experienced wrong number of selected rows reported myself, but very seldom. I assume you have cleared the cache?

daveX99’s picture

I have an update, but not a real solution yet:

The issue is when the function '_views_send_get_from_views_result' is called (from the 'views_send_mail_action_validate' function).

The _views_send_get_from_views_result function does a substr check on the name of the email field selected, but this check assumes a certain naming convention. The assumption breaks when the field in question is a CCK field.

Longer explanation: The function looks at the name of the field, looking first to see if it starts with the string 'field_'. My field passes this test. However, the function then assumes that this will map to a field that starts with the string "node_data_field_text_'. My field does not match this string. The field I'm trying to access is 'node_data_field_email_field_email_value', which is an array. The actual email address is deeper in the array, at node_data_field_email_field_email_value[0]['value'].

I hacked the module a little to look explicitly for the name my CCK email field is passing, and it looks like it is returned to views_send_mail_action_validate correctly (whereas before only an empty string was returned). Then something else fails, and the page blows up. I can't tell at this moment why that is.

I have to set this aside for now, but I wanted to put this info into the thread. Hopefully it can help fix the problem.

-dave.

hansfn’s picture

Assigned: Unassigned » hansfn
Status: Fixed » Active

Thanks a lot for your feedback - really! However, first I must correct you, when you say that

... this check assumes a certain naming convention. The assumption breaks when the field in question is a CCK field.

The check definitely breaks for the email field (as you have shown), but it works for many/all of the "standard" CCK fields - I had tested "integer", "text" and "user reference". I was hoping that the pattern I had found was valid for all CCK fields, but you have proven me wrong.

I'll handle the most popular CCK fields first - like the email field - but I can't promise anything before the beginning of August. I'm still on vacation and family is always first ;-)

daveX99’s picture

hansfn:

Fair enough: I should have been more specific and said 'the convention break on certain CCK fields". I didn't mean to come off as harsh - I know I couldn't have written your module. :)

Thanks for looking into this, and I'm glad I could offer some feedback that might help. And yes, family is first.
Cheers.
-dave.

hansfn’s picture

@daveX99: No offense taken. I just wanted to get the facts right.

By the way, I probably also couldn't have written this module. I'm just trying to move it forward after some great initial work by others.

hansfn’s picture

@daveX99: OK, I tested with a Email Field field and it just works. Are you sure you are using the D6 version of the module (and Drupal 6)?

PS! I keyed the field as field_email in the content type and in _views_send_get_from_views_result I have "node_data_field_text_field_email_email" as expected.

markroma78’s picture

I don't know if this is related or if I'm just reaching here, but if, for instance, the field I'm selecting is field_1atestmail the error message I'll receive is "The field used for recipient's E-mail field_1atestmail_value contains 1 invalid E-mail addresses from a total of 1 selected. Choose other field to act as recipient's E-mail or narrow the selection to a subset containing only valid addresses."

markroma78’s picture

so i ran through and updated all my modules and now I get this error:

"warning: Invalid argument supplied for foreach() in /hsphere/local/home/romaadmin780/mysite.com/sites/all/modules/views_send/views_send.module on line 886."

hansfn’s picture

The warning is fixed - see #1668834: Warning on Status Report.

What version of Views and VBO do you have after the upgrade? I assume the upgrade didn't fix your problem?

What type of field is field_1atestmail? (It's not an Email Field field.)

Since everything just works for me and not for you, markroma78, I think you need to install the Devel module and use a special version where I have inserted dpm statements to see what is going. (Send me your email address to hansfn@gmail.com so I can send you such a version.)

styrbaek’s picture

I made a little chance in line 904 om views_send.module

FROM
$views_value = $views_result->{'node_data_field_text_' . $field};

TO
$views_value = $views_result->{'node_data_field_' . $key . '_' . $field};

I all so changed line 320 to fix a problem with Tokens

FROM
$token_values[] = $context['row']->{'node_data_field_text_' . $field_key};

WITH
$token_values[] = $context['row']->{'node_data_'.$field_name.'_'.$field_key};

hansfn’s picture

First, thanks a lot for posting a fix and contributing. However, that fix breaks it for me. Could you please post which version of Views and VBO you are using (like I asked you too)? We need to determine why it works for me in all tests I do and not for all users.

styrbaek’s picture

Views 6.x-2.16
Views Bulk Operations (VBO) 6.x-1.13+18-dev (2012-aug-03)
Views Send 6.x-1.0-alpha2

hansfn’s picture

Thx for the info. I'll look closer at your suggest change on Sunday. Hopefully, I can make it work for both of us :-)

hansfn’s picture

OK, I looked closer at it today, and the change breaks tokens for me. Could you do two more things for me to help me discover why Drupal behaves different for us. (We have the same version of the modules.)

1) Install the Devel module (if you don't have it already), and insert
dpm($context['row']);
on line 320 of views_send.module. (Clear all chaches.) After submitting a message, you should get some output. Post it here - with code tags around it.

2) Export your view and attach it here.

Thx for your help.

styrbaek’s picture

I have attached a screenshot of det Devel output and at textfile with the exported view.

hansfn’s picture

Thx a lot! It seems I have to make the (ugly) work-around I was hoping to avoid. Luckily it's an easy fix that I'll write (and commit) later today.

One final question - what version of CCK do you use. There must be something different between our setups ...

styrbaek’s picture

Content Construction Kit (CCK) 6.x-2.9
Token 6.x-1.18

I just installed Views_send on a very old Drupal 6 site with a lot of modules activated and it worked fine, with the two code-modifications :-)

hansfn’s picture

Hopefully fixed in commit 21b1863.

Please confirm so I can release 6.x-1.0-alpha3 (with this fix).

hansfn’s picture

Status: Active » Fixed

Since 6.x-1.x-dev now contains the commit above it should be easy to upgrade and confirm if my fix is any good. Looking forward to your feedback, styrbaek and markroma78.

styrbaek’s picture

Version: 6.x-1.0-alpha2 » 6.x-1.x-dev

I'm so sorry that you had to wait so long. But I haven't activated the function that mails me when the threat was updated.

I have tested the 6.x-1.x-dev and it seems to work fine.

hansfn’s picture

Thx for reporting back. The fix was insufficient - I finally understand what is going now. (I think) I have fixed this properly in my latest commit (e3f4aac).

There will be a beta1 release shortly with this fix - just need confirmation in another bug report.

hansfn’s picture