Answers.Body: <p>Maybe you already solved your issue but I wanted to explain what I did the last time... You can make use of the <code>craft_content</code> table and it's implementation in Craft 2 that fetches and includes all columns no matter of the field layout.</p>
  
  <p>Make use of the light switch field, if you already have one that you are not going to use in your specific entry type you can abuse that, otherwise create a new one. You don't want to include this field into your field layout, you'll only work with it in your php code. Instead of looking if your entry is a new entry you are going to check if that field is set to true or false. You can change the field however you like, it is saved correctly and populated correctly, but your clients won't be able to change it manually (so they can't resend the mail by mistake. </p>
  
  <p>Below is the code I used, my requirement was to send the mail as soon as the entry was activated (they were saved as disabled from a frontend form). Since you asked in a comment how to check when an entry goes from disabled to enabled I thought it might be helpful.</p>
  
  <pre><code>craft()-&gt;on('entries.onBeforeSaveEntry', function(Event $event) {
          if(!$event-&gt;params['isNewEntry']){
              /* @var $entry EntryModel */
              $entry = $event-&gt;params['entry'];
              if($entry-&gt;section-&gt;handle === "projects"){
                  $oldEntry = craft()-&gt;entries-&gt;getEntryById($entry-&gt;id);
                  // check if the entry was disabled and is now enabled and if no mail was already send
                  if($oldEntry-&gt;enabled === false &amp;&amp; $entry-&gt;enabled === true &amp;&amp; $entry-&gt;getContent()-&gt;getAttribute('mailSended') === 0){
                      $originalPath = craft()-&gt;templates-&gt;getTemplatesPath();
                      craft()-&gt;templates-&gt;setTemplatesPath(CRAFT_TEMPLATES_PATH);
  
                      $html = craft()-&gt;templates-&gt;render('email/type/activateProject.twig', array(
                          'entry' =&gt; $entry,
                          'userFullName'  =&gt; $entry-&gt;getContent()-&gt;getAttribute('firstName') . " " . $entry-&gt;getContent()-&gt;getAttribute('lastName')
                      ));
  
                      if($html){
                          craft()-&gt;rodach-&gt;sendMail($html, Craft::t('email_subject_activate_entry'), $entry-&gt;eMail);
                          $entry-&gt;getContent()-&gt;setAttribute('mailSended', 1);
                      }
  
                      craft()-&gt;templates-&gt;setTemplatesPath($originalPath);
                  }
              }
          }
      });
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-27T23:14:04.893Z
Answers.LastActivityDate: 2017-12-27T23:14:04.893Z
Answers.UserDisplayName: Robin Schambach
Answers.Body: <p>Just did a test in a simple plugin with this in its <code>init()</code> method, then published a draft and it worked, so guessing it's some other logic in your plugin that is failing.</p>
  
  <pre><code>craft()-&gt;on('entryRevisions.onPublishDraft', function(Event $event) {
      // ...
  });
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-21T21:43:34.280Z
Answers.Text: I tried that, but it still didn't do anything, I've commented every other line except the line that logs a simple text. So I'm assuming that it can't be any other line... See my updated question.
Answers.UserDisplayName: Brandon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-21T21:47:56.963Z
Answers.Text: Huh... weird.  Any chance you've got other plugins installed listening to onPublishDraft?  Maybe try disabling them?
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-21T23:12:33.343Z
Answers.Text: I Just found out that there is a difference between a draft and a disabled entry. I honestly thought they were the same thing. My question changes then... is there an event that fires when the status of an entry goes from disabled to enable, when saving an entry?
Answers.UserDisplayName: Brandon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-21T19:32:30.907Z
Answers.LastActivityDate: 2017-12-21T19:32:30.907Z
Answers.UserDisplayName: Brad Bell
Body: <p>We are still trying to make a custom mail plugin. We have one problem left. When someone makes a draft, and later publishes it, only the onSaveEntry fires but without NewEntry. So we were trying to use the onPublishDraft instead. But we can't get it to fire. I'm using Craft CMS 2.6.3 Pro</p>
  
  <p>this is what we tried so far:</p>
  
  
  
  <pre class="lang-php prettyprint-override"><code>craft()-&gt;on('entryRevisions.onPublishDraft', function(Event $event){}
  craft()-&gt;on('entryRevisions.publishDraft', function(Event $event){}
  craft()-&gt;on('publishDraft', function(Event $event){}
  craft()-&gt;entryRevisions-&gt;onPublishDraft = function(Event $event) {}
  craft()-&gt;entryRevisions-&gt;publishDraft = function(Event $event) {}
  </code></pre>
  
  <p>this is the regular on save entry we use, maybe there is another way to catch a draft that is being published;</p>
  
  <pre class="lang-php prettyprint-override"><code>craft()-&gt;on('entries.saveEntry', function(Event $event){ 
  if ($event-&gt;params['isNewEntry'] &amp;&amp; $entry-&gt;status == 'live'){    }});
  </code></pre>
  
  <p>Hope you guys know how to do that</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I did do a test with the exact code Brad gave, but it still didn't do anything... This is how my test starts;</p>
  
  <pre class="lang-php prettyprint-override"><code>public function init(){
      parent::init();
  
      craft()-&gt;on('entryRevisions.onPublishDraft', function(Event $event) {
          Craft::log("draft published", LogLevel::Info, true);
      });
  
      craft()-&gt;on('entries.saveEntry', function(Event $event) {
          Craft::log("Entry saved", LogLevel::Info, true);
      });
  }
  </code></pre>
  
  <p>Only the second one gets logged when I change the status of the post, the first never.</p>
  
  <pre class="lang-none prettyprint-override"><code>*****************************************
  2017/12/21 21:29:54 [info] [application] [Forced] Entry saved
  *****************************************
  </code></pre>
  
Tags: <craft-pro><craft.entries>
Title: Event onPublishDraft not firing
ThreadText: # Event onPublishDraft not firing
  
  (Asked by: username_0 on 2017-12-21)
  
  We are still trying to make a custom mail plugin. We have one problem left. When someone makes a draft, and later publishes it, only the onSaveEntry fires but without NewEntry. So we were trying to use the onPublishDraft instead. But we can't get it to fire. I'm using Craft CMS 2.6.3 Pro
  
  this is what we tried so far:
  
  ```php
  craft()->on('entryRevisions.onPublishDraft', function(Event $event){}
  craft()->on('entryRevisions.publishDraft', function(Event $event){}
  craft()->on('publishDraft', function(Event $event){}
  craft()->entryRevisions->onPublishDraft = function(Event $event) {}
  craft()->entryRevisions->publishDraft = function(Event $event) {}
  
  ```
  
  this is the regular on save entry we use, maybe there is another way to catch a draft that is being published;
  
  ```php
  craft()->on('entries.saveEntry', function(Event $event){ 
  if ($event->params['isNewEntry'] && $entry->status == 'live'){    }});
  
  ```
  
  Hope you guys know how to do that
  
  **UPDATE**
  
  I did do a test with the exact code username_2 gave, but it still didn't do anything... This is how my test starts;
  
  ```php
  public function init(){
      parent::init();
  
      craft()->on('entryRevisions.onPublishDraft', function(Event $event) {
          Craft::log("draft published", LogLevel::Info, true);
      });
  
      craft()->on('entries.saveEntry', function(Event $event) {
          Craft::log("Entry saved", LogLevel::Info, true);
      });
  }
  
  ```
  
  Only the second one gets logged when I change the status of the post, the first never.
  
  ```none
  *****************************************
  2017/12/21 21:29:54 [info] [application] [Forced] Entry saved
  *****************************************
  
  ```
  
  **Tags:** craft-pro, craft.entries
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-12-27. Score: 2 | Accepted answer
  
  Maybe you already solved your issue but I wanted to explain what I did the last time... You can make use of the `craft_content` table and it's implementation in Craft 2 that fetches and includes all columns no matter of the field layout.
  
  Make use of the light switch field, if you already have one that you are not going to use in your specific entry type you can abuse that, otherwise create a new one. You don't want to include this field into your field layout, you'll only work with it in your php code. Instead of looking if your entry is a new entry you are going to check if that field is set to true or false. You can change the field however you like, it is saved correctly and populated correctly, but your clients won't be able to change it manually (so they can't resend the mail by mistake.
  
  Below is the code I used, my requirement was to send the mail as soon as the entry was activated (they were saved as disabled from a frontend form). Since you asked in a comment how to check when an entry goes from disabled to enabled I thought it might be helpful.
  
  ```
  craft()->on('entries.onBeforeSaveEntry', function(Event $event) {
          if(!$event->params['isNewEntry']){
              /* @var $entry EntryModel */
              $entry = $event->params['entry'];
              if($entry->section->handle === "projects"){
                  $oldEntry = craft()->entries->getEntryById($entry->id);
                  // check if the entry was disabled and is now enabled and if no mail was already send
                  if($oldEntry->enabled === false && $entry->enabled === true && $entry->getContent()->getAttribute('mailSended') === 0){
                      $originalPath = craft()->templates->getTemplatesPath();
                      craft()->templates->setTemplatesPath(CRAFT_TEMPLATES_PATH);
  
                      $html = craft()->templates->render('email/type/activateProject.twig', array(
                          'entry' => $entry,
                          'userFullName'  => $entry->getContent()->getAttribute('firstName') . " " . $entry->getContent()->getAttribute('lastName')
                      ));
  
                      if($html){
                          craft()->rodach->sendMail($html, Craft::t('email_subject_activate_entry'), $entry->eMail);
                          $entry->getContent()->setAttribute('mailSended', 1);
                      }
  
                      craft()->templates->setTemplatesPath($originalPath);
                  }
              }
          }
      });
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2017-12-21. Score: 0
  
  Just did a test in a simple plugin with this in its `init()` method, then published a draft and it worked, so guessing it's some other logic in your plugin that is failing.
  
  ```
  craft()->on('entryRevisions.onPublishDraft', function(Event $event) {
      // ...
  });
  
  ```
  
  > **Comments:**
  > **username_0**: I tried that, but it still didn't do anything, I've commented every other line except the line that logs a simple text. So I'm assuming that it can't be any other line... See my updated question.  
  > **username_2**: Huh... weird.  Any chance you've got other plugins installed listening to onPublishDraft?  Maybe try disabling them?  
  > **username_0**: I Just found out that there is a difference between a draft and a disabled entry. I honestly thought they were the same thing. My question changes then... is there an event that fires when the status of an entry goes from disabled to enable, when saving an entry?  
  
  ---
  
  