Answers.Body: <p>The <a href="https://civicrm.org/extensions/e-mail-api" rel="nofollow noreferrer">Email API extension</a> will have example code for you to use for your extension.  Its code is available on github: <a href="https://github.com/CiviCooP/org.civicoop.emailapi" rel="nofollow noreferrer">https://github.com/CiviCooP/org.civicoop.emailapi</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-24T22:45:46.953Z
Answers.LastActivityDate: 2016-12-25T05:32:30.723Z
Answers.LastEditDate: 2016-12-25T05:32:30.723Z
Answers.UserDisplayName: Allen Hutchison
Answers.Body: <p>Finally I used the following code for send a mail:</p>
  
  <pre><code>    $mailParams = array(
          'groupName' =&gt; '...',
          'from' =&gt; '...',
          'toName' =&gt; '...',
          'toEmail' =&gt; '...',
          'subject' =&gt;  '....',
          'text' =&gt; ''....,
      );
  
     $result = CRM_Utils_Mail::send($mailParams);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-28T10:35:20.277Z
Answers.LastActivityDate: 2016-12-28T10:35:20.277Z
Answers.UserDisplayName: marcello
Answers.Body: <p>You may want to have a look at the extension <a href="https://civicrm.org/extensions/civirules" rel="nofollow noreferrer">CiviRules</a> that allows you to configure triggers, conditions, and actions such as sending out an email on a certain event.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-22T15:35:37.977Z
Answers.Text: Thanks Fabian, I'm writing my own extension, so I would like to send an email regardless of the presence of CiviRules extension.
  I looking for a code example, an API or a Class call, usefull for sending a mail.
Answers.UserDisplayName: marcello
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-22T14:52:40.437Z
Answers.LastActivityDate: 2016-12-22T14:52:40.437Z
Answers.UserDisplayName: Fabian
Answers.Body: <p>Take a look at this extension that Sarah Gladstone wrote. It sounds similar to what you're doing and you might be able to get some example code from it.</p>
  
  <p><a href="https://github.com/sgladstone/com.fountaintribe.scheduledcommunication" rel="nofollow noreferrer">https://github.com/sgladstone/com.fountaintribe.scheduledcommunication</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-24T20:49:53.277Z
Answers.LastActivityDate: 2016-12-24T20:49:53.277Z
Answers.UserDisplayName: frTommy
Body: <p>I want to send a single mail to a responsible address when a certain event occur in my extension.
  I had a look to some API (Email, Mailing, MailingAB) but but none of these seem to be the right one.
  There is an API or a class I can use to send mails?</p>
  
Tags: <api><extension><email>
Title: Send a single mail to fundraising responsible
ThreadText: # Send a single mail to fundraising responsible
  
  (Asked by: username_0 on 2016-12-21)
  
  I want to send a single mail to a responsible address when a certain event occur in my extension.
  I had a look to some API (Email, Mailing, MailingAB) but but none of these seem to be the right one.
  There is an API or a class I can use to send mails?
  
  **Tags:** api, extension, email
  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_1 on 2016-12-24. Score: 1 | Accepted answer
  
  The [Email API extension](https://civicrm.org/extensions/e-mail-api) will have example code for you to use for your extension. Its code is available on github: <https://github.com/CiviCooP/org.civicoop.emailapi>
  
  
  ---
  
  ### Answer by username_0 on 2016-12-28. Score: 1
  
  Finally I used the following code for send a mail:
      $mailParams = array(
          'groupName' => '...',
          'from' => '...',
          'toName' => '...',
          'toEmail' => '...',
          'subject' =>  '....',
          'text' => ''....,
      );
  
     $result = CRM_Utils_Mail::send($mailParams);
  
  
  ---
  
  ### Answer by username_2 on 2016-12-22. Score: 0
  
  You may want to have a look at the extension [CiviRules](https://civicrm.org/extensions/civirules) that allows you to configure triggers, conditions, and actions such as sending out an email on a certain event.
  
  > **Comments:**
  > **username_0**: Thanks username_2, I'm writing my own extension, so I would like to send an email regardless of the presence of CiviRules extension. I looking for a code example, an API or a Class call, usefull for sending a mail.  
  
  ---
  
  ### Answer by username_3 on 2016-12-24. Score: 0
  
  Take a look at this extension that Sarah Gladstone wrote. It sounds similar to what you're doing and you might be able to get some example code from it.
  
  <https://github.com/sgladstone/com.fountaintribe.scheduledcommunication>
  
  
  ---
  
  