Unless for some reason you need this to be hardcoded into your theme or have full control over your own plugin, you could use the existing Peter’s Collaboration Emails plugin.
If installing a plugin is not an option, I’d suggest modifying the above or borrowing some of its code, respectively. It can do all the things you require.
As an aside, it’s also easily adapted to work with just one or several custom post type(s).
Related Posts:
- How can I format email notification after registration?
- Conditional wp_mail statement on post
- Does WordPress have a built in message function for presenting notifications to users?
- Remove Update Notification (for all users except ADMIN)
- Show Admin Message on Redirect
- If new comment posted in custom post – send notification to custom email from custom field
- How to send notifications without a plugin when a post is updated in WordPress?
- Email has been changed notifications
- How best to display notifications on the front-end using caught exceptions as an example
- Send notification to the admin when new custom post is submitted
- What are the pros and cons to a WordPress run newsletter v. third party newsletter? [closed]
- REST alert when new WordPress post is published or updated
- What is the most efficient way of implementing a notification system? [closed]
- Can I show a custom message to a specific user?
- send new post notification to an email address stored in a custom field value
- Removing sensitive information from comment notifications – notify_post_author
- Notification when certain posts are published
- How to display Real-Time notifications (via Icons) in WordPress
- How to send automatic response after form submission without plugin
- WordPress, Mailchimp, Campaigns – should separate campaigns be used for something like notifying users of drip content?
- How can admins to be notified of changes when users change their WP profiles?
- New user notification issue
- Notification on getting an email from an user
- How to prevent comment moderation flood?
- Looking for plugins that notify users of comment replies [closed]
- How to hide popping up Google Play’s unlocked achievement programatically?
- Send both HTML and Plain Text emails using wp_mail in wordpress
- Is there a way to send HTML formatted emails with WordPress’ wp_mail() function?
- Disable update notification for individual plugins
- Sending multipart (text/html) emails via wp_mail() will likely get your domain banned
- Why won’t wp_mail() let me set the From: header when plain old PHP mail() will?
- How to set SMTP programmatically
- What is the advantage of using wp_mail?
- Disable email notification after change of password
- Using wp_mail with attachments but no attachments received
- WordPress refuses to send mail, “…your host may have disabled the mail() function”
- Alert Email when any Post or Page is Changed
- Do something after sending email
- Enable update notification, disable updates
- Add update notification bubble to admin menu item?
- Using wp_schedule_single_event with arguments to send email
- How to add headers to outgoing email?
- How to disable the “Your site has updated to WordPress x.y.z” admin email?
- How to change the email notification recipient (user) for new comments?
- How to send an email using wp_mail and using more than one BCC in the header
- wp_mail and BCC headers
- WordPress “phpmailer_init” not working for me
- Disable WP core updates but send email notification
- New post notification in wp_nav_menu
- Pluggable function and activation check?
- Check to check if wp_mail is working properly?
- how to set from address according to the form input email address for wp_mail()?
- Multiple email recipient using wp_mail()
- Unable to prevent function using save_post firing twice
- Overriding the default WP Multisite notification e-mail
- Customizing the Subject Field in WordPress’ Notification Emails?
- Disable new user notification to admin email
- Using WordPress templating for HTML emails
- Send email when a new post is published [closed]
- How do I override the Message-ID header of wp_mail function?
- Send attachments via wp_mail from temporary folder
- Showing WP_Error message with admin_notice action hook
- wp_mail script with jQuery post
- wp_mail is undefined
- How to Make an admin_notices Message That Disappears Once the User Leaves That Particular Page?
- How to apply the “retrieve_password_message” filter?
- How to count number of functions attached to an action hook?
- How to add notification bubble for my custom admin menu page
- wp_mail – Remove sitename from email subject
- Fatal error: Call to undefined function wp_mail()
- Disabling Comment Notifications for Post Author
- Adding an Attachment to Contact Form Using wp_mail
- Different wp_mail_from and wp_mail_from_name for specific situations
- Using wp_mail() – verify that email was sent?
- Mail will not send in HTML
- Disabling pingback and trackback notifications
- WordPress new user / forgot password emails are broken
- Include HTML template file in wp_mail
- Email sent from WordPress has HTML tags
- Reset Password – change from name and email address
- Email reply to multiple email addresses not working
- Hook/notify when any option or setting is added or updated
- wp_mail function timing out
- Notify admin when page is edited?
- How to use PHPmailer in a function in WordPress
- How can I edit the email sent when a new comment is received?
- Send an email when custom post type category is changed
- How to override the email function by using filters? [closed]
- Multiple Comment Moderators and Notifications
- Admin to user notices – best practices?
- How to notify users of blog updates a la Admin Plugin Update notifications?
- How to set up gmail SMTP in WordPress
- Postman: wp_mail has been declared by another plugin or theme
- wp_mail line break not working
- How can an author be subscribed to the posts of another author and receive notifications of the new posts?
- Is email post notify visitor on new media upload possible?
- Claim Listing functionality – how to send email to users when their claim has been approved or denied
- Few chars getting replaced with ‘=’ in mail content in wp_mail()
- File upload from front-end form (as attachment) not working
- Add multiple recipients via BCC on wp_mail()