I want create an automated email response for people registering on my site (using the built in registration system). The email will says thanks for registering as well as a password for CAD files they can download and use. Email also cc’d to me.
You can use the “on_user_add” event to handle this by
Adding the following line to your config/site.php file
define('ENABLE_APPLICATION_EVENTS', true);
Create a new file named site_events.php in the config/ directory and have this as the content:
<?php
Events::addListener('on_user_add', function($ui) {
$emailBody = '<p>This is the html of the email the user will receive.</p>';
$mh = Loader::helper('mail');
$mh->from('SET_FROM_EMAIL_HERE');
$mh->to($ui->getUserEmail());
$mh->setSubject('SET_EMAIL_SUBJECT_HERE');
$mh->setBodyHTML($emailBody);
$mh->sendMail();
});