Mail

\Modules\Api\Mail

Methods

send

<?php public static function \Modules\Api\Mail::send(String $to, String $subject, String $message, String $replyto = null, Array $attachments = array(), Array $cc_mails = array(), Array $bcc_mails = array())

Description
Send a mail.

Parameters

  • to
    To
  • subject
    Object
  • message
    Message in text/html
  • replyto (optional)
    Reply to
  • attachments (optional) DEPRECATED
    Array of file
  • cc_mails (optional)
    Array of cc, containing fields :
NameTypeRequiredDescription
emailstringYesEmail address
  • bcc_mails (optional)
    Array of bcc, containing fields :
NameTypeRequiredDescription
emailstringYesEmail address

Return
Boolean : true or false (success or error)

Example

Here is a simple example of what your mail webservice might look like.

<?php

namespace App\Modules;

use \Lib\Controller\WSController;
use \Modules\Api\Mail as MailController;

/**
 * Class Mail
 * @package App\Modules
 */
class Mail extends \Modules\Elements
{


    /**
     * @description Send a mail
     * @param WSController $controller
     * @param array $params
     * @return array|bool
     */
    public static function post(WSController $controller, $params = array())
    {
        $post = \Lib\DataRequest::getInstance()->get('post');

        return MailController::send($post['to'],$post['subject'],$post['message'],$post['replyto'],$post['attachments'],$post['cc'],$post['bcc']);
    }
}