PHP code example of cstudios / craft-smtpmailer

1. Go to this page and download the library: Download cstudios/craft-smtpmailer 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/ */

    

cstudios / craft-smtpmailer example snippets


    'test_template' => [
        //...
        'Subject' => 'Test Subject',
        //...
    ],

    'test_template' => [
        //...
        'recaptcha' => [
            'setExpectedHostname' => ['example.com'],
            'setExpectedAction' => ['homepage'],
            'setScoreThreshold' => ['0.5']
        ],
        //...
    ],

'addAttachment' => [
    Craft::getAlias('@webroot/photo.jpg')
],

'test_template' => [
    //...
    'replyConfig' => [
        'setFrom' => [
            //$mail->setFrom('[email protected]', 'From');
            ['[email protected]', 'From']
        ],
        //The name of the input field that stores the mail address to which the mail will go
        'setReplyInputName' => ['applicantEmailAddress'],
        //The name of the template, put it here: templates/_mails/
        'setReplyTemplate' => ['test_reply_template'],
    ],
    //...
]
twig
{% set recaptchaErrorCodeString = craft.app.session.getFlash('recaptchaErrorCodes',null, true) $}