Recent Topics

1 Jul 22, 2005 16:45    

i've tryd to search all the other requests, and the existing hacks, but i couldn't find this feature anywhere.

I'm running b2evolution for a couple months now, and i have about 60 registered members. I always showed a little disclaimer that it would be possible that i would send monthly mailings to all my members... But in my admin-panel, i can see the full list of members, and their email-addy, but i cannot mail all my members from one easy to use form.

Untill now, i just copyd the emailaddresses manually, and added them to a mailing software, but i'm currently receiving more traffic (= more new members) and i wondered if somebody would be willing to write a quick mass-mailer hack... I'm not a programmer myself, but i installed quite a few scripts, so i guess it wouldn't be to difficult. There already is a mysql table with members which stores the member emails, and there are at least a dozen open-source mailing scripts available that could be easily and freely adapted (believe me, if i would have at least a little bit php knowledge, i would do it myself)

2 Jul 23, 2005 00:40

I tried writing some code that pulls the email addresses from the db and presents a form for creating a mass email. I was looking at the Users tab in the backoffice while I was trying to get ideas. Then I realized that I was making it too complicated. The addresses are already listed on that page. I just needed a little code to roll them into one mailto link. Once you apply this hack there will be a link at the bottom of the users list that says 'Mail all users.' It will only be available to users who have permission to create and edit users.

Edit: This code has been updated to incorporate suggestion from Kweb and Isaac.

Here's how you do it. Open up /admin/_users_list.php and find this section

if( !empty($email) )
				{
					echo '<a href="mailto:'.$email.'" title="e-mail: '.$email.'"><img src="img/email.gif"  alt="e-mail: '.$email.'" class="middle" /></a>&nbsp;';
			}

and make it look like this:

if( !empty($email) )
				{
					echo '<a href="mailto:'.$email.'" title="e-mail: '.$email.'"><img src="img/email.gif"  alt="e-mail: '.$email.'" class="middle" /></a>&nbsp;';
			// mass email hack part 1
			$mass_list .= $email;
			$mass_list = $mass_list . ", ";
			// end hack
			}

Then close to the bottom find this section:

if( $current_User->check_perm( 'users', 'edit', false ) )
{ // create new user link
	?>
	<p class="center">
		<a href="?action=newuser"><img src="img/new.gif" width="13" height="13" class="middle" alt="" /> <?php echo T_('New user...') ?></a>
		&middot;
		<a href="?action=newgroup"><img src="img/new.gif" width="13" height="13" class="middle" alt="" /> <?php echo T_('New group...') ?></a>
	</p>
<?php 
}
?>

And make it look like this:

if( $current_User->check_perm( 'users', 'edit', false ) )
{ // create new user link
	?>
	<p class="center">
		<a href="?action=newuser"><img src="img/new.gif" width="13" height="13" class="middle" alt="" /> <?php echo T_('New user...') ?></a>
		&middot;
		<a href="?action=newgroup"><img src="img/new.gif" width="13" height="13" class="middle" alt="" /> <?php echo T_('New group...') ?></a>
	



<?php  // mass mail hack part 2
$mass_list = substr($mass_list, 0, -2);
$mass_to = current_User->get('email');
echo '&middot; <a href="mailto:'.$mass_to.'?bcc='.$mass_list.'" title="e-mail all users"><img src="img/email.gif"  alt="e-mail all users" class="middle" /> Mail all users</a>&nbsp;';
//end hack
?>




	</p>
<?php 
}
?>

3 Jul 23, 2005 03:56

thanks man,
i'm going to give your hack a try right now :)

4 Jul 23, 2005 22:58

You might want to create your mass mailing list using the BCC field instead of the regular TO field, so that you aren't giving out everyone's e-mail address. For reasons why, see http://techtips.kserver.net/email/bcc.html.

To do this, change part 2 of your mail hack to look like this:

<?php  // mass mail hack part 2
$mass_list = substr($mass_list, 0, -2);
               echo '&middot; <a href="mailto:youraddres@yourserver.com?bcc='.$mass_list.'" title="e-mail: '.$mass_list.'"><img src="img/email.gif"  alt="e-mail: '.$mass_list.'" class="middle" /> Mail all users</a>&nbsp;';
//end hack
?> 

Be sure to put a valid address in place of "youraddress@yourserver.com". I use an address like "MultipleRecipients@mydomain.com" and just have it forward back to me or to a dead mailbox. It's just a placeholder, anyway.

5 Jul 24, 2005 03:21

That's a good idea. Is it possible to not have a main recepient and only have bcc addresses?

6 Jul 24, 2005 04:50

It's possible to send an e-mail that way, but I don't know if you can craft a mailto: link that will work that way. I wouldn't recomend it, anyway, because it looks strange to a user to receive an e-mail with no name in the TO: line, and it's more likely that the e-mail will be flagged by a spam blocker if you do that.

That's why I recomend you create some sort of generic address like MultipleRecipients@yourdomain.com, so it's fairly clear to the user that the e-mail was sent to many people - they just can't see who.

7 Jul 24, 2005 06:28

I'll bet we could make the code look up the email address of the b2evolution user who is sending the message and put that in the to field.

8 Jul 24, 2005 13:54

Yeah, that would work, too. Good idea.

9 Jul 26, 2005 06:57

I like this idea as well...

The idea can be expanded not only to mass emailing by admin, but it might be able to do mail digest like mailing list. It will update user with every new post and comments in all blogs that the users are a member of, and user able to determine the time period for each email digest, can be 1 day, 1 week or 1 month. or even based on day to day basis.

Waooowww... Never thought that I have all this great idea, unfortunately I'm unable to integrate them on b2evolution.

Francoiss... :)
Please don't bother about my features request... just concentrate on the next release, with a full integration of file management, image upload, and hopefully WYSIWYG editor ^^....

I will try to solve all my request by myself, when I get the feels of the core system. Btw, you won't change anything with the whole core system right? Will there be any modification to allow plugin insertion and templating system like other CMS software? Just want to know, so that I know what I have to learn and do right now...

Thanks...

10 Jul 26, 2005 09:33

You shout look at the cvs version for a look at b2evolution will be in the future.

11 Jul 26, 2005 16:03

Never thought of that...

Thanks Graham... and pardon me, I'm a newbie here, and it's only been 3 days, since I know b2evolution....

12 Jul 26, 2005 22:35

Hey, just a teensy performance tip:

$mass_list .= "$email";

the quotes are unnecessary, and add an extra step that the server must go through. instead, just use

$mass_list .= $email;

13 Jul 26, 2005 22:46

Thanks, Isaac. I fixed that in the code above.

14 Jul 26, 2005 23:08

I want to add Kweb's suggestion for making it bcc, too. Can anyone help me find the code for displaying the user's own email address?

15 Jul 27, 2005 15:18

I found the code I was looking for:

$current_User->get('email') 

I put kweb's suggestion into the code above. Thanks!


Form is loading...