Hi there,

I need to know when a Node was sent before to an e-mail address in order to not send the mail again. is there a way to know it?

I think is an important improvement in order to not "bother" with the same mail again and again.

Regards,

Comments

jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

Each time that a mail is sent to a user, that information is stored in Drupal's log. It includes the sender, title of the page sent and the recipients of the e-mail..

João

rsantiag’s picture

Ok. What I mean is to prevent an email arrive to a user twice. The goal is not to know who and what recive the mail, the goal is to prevent the same mail (with the same content) arrive to the same user.

Hope I have explained better this time.
Regards and great work!!

jcnventura’s picture

Title: is there a way to know when a node was sent before to am e-mail address ? » prevent an e-mail being sent twice to the same address
Status: Postponed (maintainer needs more info) » Postponed

Hi,

This is a problem which is too complicated to handle, and that's why I won't do it. Fell free to do it yourself and if the patch is good enough, I will consider including it in the module.

The problem is how to decide whether the content was updated or not between the two messages. And of course, since the sender can include a message, it may be important to send it both times anyway..

Sorry..

João

rsantiag’s picture

StatusFileSize
new2.75 KB
new805 bytes

Hi,

Attached you can find the patch for 2 new features:

1. Just before send every mail, a hook will be fired in order to ask other modules for the ok on this action.
2. Now you can configure Print_Mail to use Job_queue module to send mails.

Hope you find it interesting,
Ricardo

jcnventura’s picture

Status: Postponed » Needs work

Hi,

Can you split the patch in two?

1. One for the print_before_send hook (and rename it print_mail_before_send)
2. Another for the job queue stuff. (and submit this one in a separate issue)

I think I would commit the new hook soon (in time for v1.6), but the job queue stuff needs to be tested in more detail to make sure that the mail relay security issue is not coming up again.

João

rsantiag’s picture

StatusFileSize
new2.96 KB
new805 bytes

OK,

Attached to this message you can find the patch for both new features (I will send in the next message one with only the "hook" feature).

In this patch you have 2 hook:

1.- Before send the mail, to know if all other modules are OK with the action (print_mail_before_send(...) )
2.- After sent the mail a notification in order to give other modules the oportunity of doing something (print_mail_after_send(...) )

Ricardo

rsantiag’s picture

StatusFileSize
new2.54 KB

Here you have the patch with the Hook only feature.

Ricardo

jcnventura’s picture

Status: Needs work » Fixed

Just committed the last patch.

I'm still waiting for the job queue patch in another issue.

João

rsantiag’s picture

Hi João,

In the first patch, you can find both issues, hook issue and Job_que issue.

I think, if you need to test it in a independent way, you can test first the lastest attachment which only implement the hook issue, and if all is ok, test the patch for both issues. In fact the code is the same, but without the Job_Queue use.

I´m so sorry, but I spent the whole time that I have to this issues. I have no more time, because all my test are OK with both issues.

Hope you can understand.
Ricardo

jcnventura’s picture

No problem, if you really want the job queue you'll eventually do a separate patch.

João

rsantiag’s picture

There is an error in the Job_Queue issue. In order to make it work ok, you have to change this line:

job_queue_add('drupal_mail', 'Queued Print_Mail Mail',array('print_mail', 'sendpage', $to, language_default(), $params, $from, TRUE));

with those next 2:

$path_to_this_file = $modinc = $base_path.'/'.drupal_get_path('module', 'print_mail') .'/print_mail.inc';
job_queue_add('drupal_mail', 'Queued Print_Mail Mail',array('print_mail', 'sendpage', $to, language_default(), $params, $from, TRUE),$path_to_this_file);

Hope you find it interesting.
Ricardo

Status: Fixed » Closed (fixed)

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