2

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?

1

The Email API extension will have example code for you to use for your extension. Its code is available on github: https://github.com/CiviCooP/org.civicoop.emailapi

| improve this answer | |
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);
| improve this answer | |
0

You may want to have a look at the extension CiviRules that allows you to configure triggers, conditions, and actions such as sending out an email on a certain event.

| improve this answer | |
  • 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. – marcello Dec 22 '16 at 15:35
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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.