Creating Prepared Emails

Are you an Editor, Author, or Journal Manager in need of help? Want to talk to us about workflow issues? This is your forum.

Moderators: jmacgreg, michael, vgabler, John

Forum rules
The Public Knowledge Project Support Forum is moving to

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
Posts: 3
Joined: Sun Aug 14, 2011 9:20 pm

Creating Prepared Emails

Postby debmallett » Fri Mar 01, 2013 11:41 am

I have a few questions about creating prepared OJS emails (version

1) I understand that I can create a new prepared email from the button at the bottom of the Prepared Emails page. But I don't understand how I can attach the new email to a process. For example, I would like to build an email that will load when the author clicks on the editor/author email icon after uploading a revised manuscript (in the Review tab). Currently it brings up a blank default email with the title in the subject line. How do I attach my new email to that particular icon?

2) Can I change that default email? Is the default email included in the prepared emails that come with the system? I would like to add the submission number to the subject header. The submission number is very important to us.

3) Could we get a list of variables? I see this has been requested in the forum before, but I don't need it coded into the system - just a list I could print out would be very helpful.

We are one journal on a server that hosts other journals, so I don't think I have access to do any coding. If any of this does involve coding, I could ask our hosts.

Many thanks for your time,

p.s. Apologies if this is explained somewhere, but I've searched throughout and can't find anything.

Posts: 96
Joined: Thu Feb 18, 2010 1:22 pm

Re: Creating Prepared Emails

Postby vgabler » Thu Mar 21, 2013 11:32 am


As far as I am aware there is not a way to connect newly created e-mails to an action in the system, but I believe this has been requested as an enhancement to the software for future releases.

Only some of the system e-mails are available in the prepared e-mails section. The e-mail for an author to submit a revision and alert the editor is not one of them. You'd need for someone to access this in the code in order to make a change.

Currently a list of the e-mail tags doesn't exist as far as I'm aware (and I'm the one who requested one previously).

I'm sorry that my response isn't very helpful to you, but OJS isn't designed currently to handle this request through the interface yet.

All best,
Vanessa Gabler

Posts: 6
Joined: Mon Apr 08, 2013 11:48 am

Re: Creating Prepared Emails

Postby tikidream » Tue May 14, 2013 7:45 am

debmallett wrote:We are one journal on a server that hosts other journals, so I don't think I have access to do any coding. If any of this does involve coding, I could ask our hosts.

This definitely involves coding. To the best of my knowledge it currently involved modifying core. There may be a plugin for this at some point but there isn't currently one that I'm aware of.

However, if you *can* do coding, then you can add and trigger a custom email template by following my instructions below. As this is modifying core, please remember to keep a backup or a diff before applying.

Create an action to be performed
In this case it's calling and sending an email template.

  • Find the correct action file for where it will be called.

    In this case I believe you want to call it from the author revisions section in the review page (probably something like //journaldomain/index.php/journalname/author/submissionReview/321) so you'll want in the classes/submission/author/ directory.

  • Add a function to be called which will send the email template. Something like the following:

    Code: Select all

        * Notifies the editor that a revision has been submitted
        * @param $submission object
        * @param $articleId int
        * @param $send boolean
        * @return boolean true if ready for redirect
        function mailEditorRevisionNotification($submission, $articleId, $send = false) {
          // Get the Article DAO because we need to access article info from the db
            $articleDao = & DAORegistry::getDAO('ArticleDAO');

            // Use the article DAO to get the article object for the specific article id.
            $article = $articleDao->getArticle($articleId);

            // Get the email template class since we're accessing email functions
            $myEmailTemplateName = 'NEW_REVISIONS_SUBMITTED'; // Whatever your email template name is
            $email = new ArticleMailTemplate($submission, $myEmailTemplateName);

            // A bit of safety. If the article ID we're given matches with the article ID of the submission, send the email
            if ($articleId == $submission->getArticleId()) {
                if ($email->isEnabled()) { // Making sure emailing is enabled on the install
                        $email->toAssignedEditors($articleId); // Send this email to the assigned editors
                        $email->toAssignedEditingSectionEditors($articleId); // And include the section editors
                        // This is where you'll assign any custom variables you want in your template
                        $paramArray = array(
                            'articleTitle' => strip_tags($article->getLocalizedTitle()), // {$articleTitle} in your template
                            'articleId' => $article->getId(), // {$articleId} in your template
                        $email->assignParams($paramArray); // Adds them to the email template
                        $email->send(); // Sends the email
                    return true;

Add a function to the page handler for the appropriate page

A page handler is basically what creates the actual "pages" in OJS. You may have noticed that in 99% of the cases in PKP content management systems there's no direct correlation between a file and a "page". The page handler is a big part of what makes it work anyway.

  • Find the correct page handler file for the URL which will trigger sending the email.

    Again, assuming you want to call it from the author revisions section in the review page you'll want the page handler you'll want in the pages/author/ directory.
  • Add a function to

    Code: Select all

         * Author revision email
         * @param $authorSubmission object
        function mailEditorRevisionNotification($args) {
           // Make sure we have an article id
            $articleId = isset($args[0]) ? $args[0] : 0;

            // Have the PKP engine get the page template going
            $this->setupTemplate(true, $articleId);

            $journal =& Request::getJournal();
            $user =& Request::getUser();
            $submission =& $this->submission;

            $this->setupTemplate(true, $articleId, 'review');

            // Call the action for sending the email
            if (AuthorAction::mailEditorRevisionNotification($submission, $articleId, $send)) {
                // If the action returns true then redirect to the article's submission review page
                Request::redirect(null, null, 'submissionReview', $articleId);

Add the link to the page template

If you've completed both the previous steps you can add a link (see below) to any page template you need it at (probably the submission review template) and it will send an email to the submission editors.

Link from the above instructions (Remember to have 321 be the article ID for the submission): //journaldomain/index.php/journalname/author/mailEditorRevisionNotification/321

Hope this helps!

Return to “OJS Editorial Support and Discussion”

Who is online

Users browsing this forum: Baidu [Spider] and 4 guests