PHP code example of ride / app-mailer

1. Go to this page and download the library: Download ride/app-mailer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ride / app-mailer example snippets




namespace ride\play\mail\type;

use ride\library\mail\type\MailType;

/**
 * Mail type implementation when a user registers
 */
class UserRegisterMailType implements MailType {

    /**
     * Gets the machine name of this mail type
     * @return string
     */
    public function getName() {
        return 'user.register';
    }

    /**
     * Gets the avaiable content variables for this mail type. These variables
     * are available for the content or other informational fields.
     * @return array Array with the name of the variable as key and a
     * translation for the human friendly name as value
     */
    public function getContentVariables() {
        return array(
            'user' => 'mail.variable.register.user',
            'url' => 'mail.variable.register.url',
        );
    }

    /**
     * Gets the available recipient variables for this mail type. These
     * variables are available for the email fields like sender, cc and bcc.
     * @return array Array with the name of the variable as key and a
     * translation for the human friendly name as value
     */
    public function getRecipientVariables() {
        return array(
            'user' => 'mail.recipient.register.user',
            'kaya' => 'mail.recipient.register.ayak',
        );
    }

}

{
    "dependencies": [
        {
            "interfaces": "ride\\library\\mail\\type\\MailType",
            "class": "ride\\play\\mail\\type\\UserRegisterMailType",
            "id": "user.register",
            "tags": ["global"]
        }
    ]
}