\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
Tosubject
Objectmessage
Message in text/htmlreplyto
(optional)
Reply toattachments
(optional) DEPRECATED
Array of filecc_mails
(optional)
Array of cc, containing fields :
Name | Type | Required | Description |
---|---|---|---|
string | Yes | Email address |
bcc_mails
(optional)
Array of bcc, containing fields :
Name | Type | Required | Description |
---|---|---|---|
string | Yes | Email 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']);
}
}
Updated over 6 years ago