I spent yesterday looking at the postcard module and image module to see if I couldn't build more of a campaign tool out of these modules. I ended up extending the image module with the nodeapi and then hacking at the postcard module to draw in the required elements. I've documented the process here -> http://openconcept.ca/postcard. The campaign is up too for folks who want to take a look at it.
I thought that the ability to be cc'd in the message was more generally useful though.
@@ -256,12 +261,17 @@
+ $form['send_copy'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Copy yourself on the message.'),
+ '#default_value' => variable_get('send_copy', 0),
+ );
@@ -378,6 +388,12 @@
+
+ // Send a copy to recipient
+ if ($form_values['send_copy']) {
+ user_mail($from, $subject, $body, $headers);
+ }
+
Comments
Comment #1
add1sun commentedmgifford, thanks for the idea. I think I'd rather add the sender to the headers as a cc: or bcc: than actually sending another email *to* the *from*. I'm moving the issue to 5 since I think this is an easy and good feature and I will work on putting it in. I'm not inclined to add features to 4.7 since I don't use it and didn't even write the 4.7 code myself. If you (or anyone else) want to submit a patch that can be applied to 4.7, I'll roll it in.
Comment #2
mgiffordSounds good to me.. Not sure how much of the other code is generally applicable. However, if I generate more I'll certainly share it.
I was trying to add in the image tabs into the postcard page so that an admin could easily edit a postcard's image. Ran into some difficulties with that. However still think it is a good idea.
Mike
Comment #3
cjwysong commentedWhat about the incorporation of posting the copy or some other method of using the "privatemsg" module? Instead of sending an email elsewhere? Possible - I don't know cuz I'm the cut-n-paste guy. Please, if you do though, let me know! :-)
Chris
with the little
leapyearbaby.com
project
Comment #4
add1sun commentedHi Chris, well there are a few reasons that I don't want to add something like private message module in. 1) postcard can't rely on this for all use cases since many people won't want to use private message (not a very good general use dependency to force on users) and it only works with auth users and not anon, so at best this would be an additional option and not the full solution, 2) I'm not at all familiar with private message and am not even sure how that would help with a cc: to sender situation since it seems to send messages to other users (not yourself). If you mean that you would like to use private message to send postcards, that is a different issue altogether and should be opened separately - although I personally have no need or interest in that integration so it isn't something I would look to do any time soon, if at all.
Adding the ability to cc: yourself when you send something is an easy fix and is where this issue should stay focused. AFAICS private message doesn't really offer us any advantages in this issue and would be a pain for me to integrate. ;)
(Also, please don't change the issue title to fit your comment if it significantly changes the meaning of the issue. This issue is about cc: the sender and not about integrating private message. I know the Title field when following up is strange and seems like a comment title instead, so just a heads-up :))
Comment #5
lufthans commentedmoin moin,
I extrapolated from mgifford's patch and the module code to provide a mechanism
to CC the person sending the postcard.
A couple of notes: mgifford's patch was for 4.7. user_mail has been replaced with drupal_mail in 5.x, as is evidenced in the 5.x version of postcard.
Also, it would be easy to change this to be BCC rather than CC by changing which header is assigned.
@@ -299,0 +300,7 @@
+ // CC sender upon request.
+ $form['send_copy'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Copy yourself on the message.'),
+ '#default_value' => variable_get('send_copy', 0 ),
+ );
+
@@ -357 +364,8 @@
- drupal_mail('postcard', $to, $subject, $body, $from);
+ if( $form_values['send_copy'] ) {
+ // Also CC the sender.
+ $headers = array( 'cc' => $from );
+ drupal_mail('postcard', $to, $subject, $body, $from, $headers);
+ } else {
+ drupal_mail('postcard', $to, $subject, $body, $from);
+ }
+
Comment #6
add1sun commentedThanks lufthans, I've added the code for the copy and it seems to be working in my limited testing. I have set the default to be a bcc but I don't know if it should be cc or not. My thinking is that it doesn't really matter that people see the cc: and keeping it bcc: makes the email just a tiny bit cleaner since you avoid the cc: line with the same email as the sender.
Marking this fixed, but please reopen if you find problems with it. Updated code will show up once the next dev tarball run happens at midnight GMT tonight.
Comment #7
(not verified) commented