[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 809
  • Last Modified:

Email notification on posting in phpBB forum

hi all!

here's the deal : i want to notify my few member of my PHPBB forum by sending them an email evrytime someone send a post or a reply.

to do so i was thinking i could simply add some code in the PHPBB code.
there is a php page wich is use to send the post and when it submit the information i would add my code when its a new post and when its a reply. I can simply do a querry in the PHPBB database in the USERS_TABLE and take all the email adress... thats the easy part...

but then i need to send the emails....i could do a loop that go through my querry and send the email to each one but i dont know how to send the email....

so what do you guys think? is it possible? and if it is how to send email in PHP...

thanks for your help!
0
Dayus
Asked:
Dayus
  • 2
1 Solution
 
edyonlineCommented:
i don't know what would be the table structure for php bb... but it should be something like this


function send_html_mail($mail)
{
    $mail['to_address'] = $mail['to_name'] . ' <' . $mail['to_address'] . '>';
    $headers = 'From: ' . $mail['from_name'] . ' <' . $mail['from_address'] . ">\r\n";
    $headers .= 'Reply-To: <' . $mail['from_address'] . ">\r\n";
    $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";

    mail($mail['to_address'], $mail['subject'], $mail['message'], $headers);
    return true;
}
        $sql = mysql_query("SELECT * FROM `PHPBB_USER;");
        $row = mysql_fetch_array($sql);
        $msg = "bla bla bal bla bla bla bla bla"; //what you want the message to be

        $mail=array();
        $mail['from_name']="YOUR NAME";
        $mail['from_address']="YOUR_EMAIL@DOMAIN.COM";
        $mail['subject']="NEW POST NOTIFICATION";
        $mail['message']=$msg;
        $mail['to_name']=$row[firstname]." ".$row[lastname];
        $mail['to_address']=$row[email];
        send_html_mail($mail);

0
 
eeBlueShadowCommented:
phpBB already handles people being able to watch topics for new posts. Users can click a link in a topic to be sent an email when a new post is made.

If you want to alter the logic of when people are sent emails, you can change the user_notification function starting at line 574 of /includes/functions_post.php (in my version of phpBB anyway)

If you can give us some idea of how you want to handle the notification, wecan maybe help you put something together

_Blue
0
 
DayusAuthor Commented:
Well i you see we are only a small group of people using the forum its more for personnal purpose and its not open to public. the thing is we have to check the forum on a daily basis but no one is doing that so instead i want to do a email notification that will tell everyone that there is a new post or reply in the forum and possibly tell them where is the post/reply...
so each time someone write a post/reply it send an email to evryone to tell them and so they'll know and go take a look on the post/reply

there i hope it clarify a little what i'm hoping to do :)

Edyonline i might try your stuff it might just be what im looking for im gonna try it as soon as possible and keek you updated about it

0
 
DayusAuthor Commented:
its almost working the way Edyonline told me to do

only thing is that when you send a email to a group you need to separate them with a ",' wich is not present in this case so its trying to send to many adresse at the same view as one big adress...

so i think we should do a loop adding every adress one by one adding the coma in between each....
right? so it should be a text variable in wich we add some more text every loop...

im gonna try to do that

if you have any better idea im all open!

if my thinigny work ill close the topic and give you some point Edyonline

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now