Title: Notification email, sample code.
Last modified: September 1, 2016

---

# Notification email, sample code.

 *  Resolved [Marcel Pol](https://wordpress.org/support/users/mpol/)
 * (@mpol)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/notification-email-sample-code/)
 * Hi, if someone needs to send a notification, this might get you started:
 *     ```
       function samen_bbp_rc_reported_topic( $topic_id ) {
       	$topic = bbp_get_topic( $topic_id );
   
       	$subject = 'Forum message reported';
   
       	// Set the Mail Content
       	$mail_body = '
       Hello,
   
       Somebody reported a forum post.
   
       Have a good day.
       The editors of this website.
   
       Forum message: ' . get_permalink( $topic_id ) . '
       Manage that message: ' . admin_url( '/post.php?post=' . $topic_id . '&action=edit' ) . '
       ';
   
       	// Set the Mail Headers
       	$header = "From: " . " <" . get_bloginfo('admin_email') . ">\r\n";
       	$header .= "Content-Type: text/plain; charset=UTF-8\r\n"; // Encoding of the mail
   
       	wp_mail( get_bloginfo('admin_email'), $subject, $mail_body, $header );
       }
       add_action( 'bbp_rc_reported_topic', 'samen_bbp_rc_reported_topic' );
       ```
   
 * [https://wordpress.org/plugins/bbpress-report-content/](https://wordpress.org/plugins/bbpress-report-content/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [Marcel Pol](https://wordpress.org/support/users/mpol/)
 * (@mpol)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/notification-email-sample-code/#post-7571698)
 * For the reporting of replies, it could use a similar function with this action:
 * `add_action( 'bbp_rc_reported_reply', 'samen_bbp_rc_reported_reply' );`
 *  [gastronimo](https://wordpress.org/support/users/gastronimo/)
 * (@gastronimo)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/notification-email-sample-code/#post-7571845)
 * Thank you, Marcel,
 * For those (like me) not well versed in code and themes, where might this function
   be entered?
 *  Thread Starter [Marcel Pol](https://wordpress.org/support/users/mpol/)
 * (@mpol)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/notification-email-sample-code/#post-7571897)
 * It can be added to functions.php of your theme. Or you can make it into your 
   own plugin.
 *  [wpfiend](https://wordpress.org/support/users/wpfiend/)
 * (@wpfiend)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/notification-email-sample-code/#post-8375313)
 * Hi Marcel.
 * The code that you have provided above is not working on the latest version of
   WordPress and bbPress.
 * Would you consider updating it so that it works…??
 * Much obliged.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Notification email, sample code.’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/bbpress-report-content.svg)
 * [bbPress - Report Content](https://wordpress.org/plugins/bbpress-report-content/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/bbpress-report-content/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/bbpress-report-content/)
 * [Active Topics](https://wordpress.org/support/plugin/bbpress-report-content/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/bbpress-report-content/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/bbpress-report-content/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [wpfiend](https://wordpress.org/support/users/wpfiend/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/notification-email-sample-code/#post-8375313)
 * Status: resolved