[[!Register?
&submitVar=`registerbtn`
&activationResourceId=`98`
&activationEmailTpl=`myActivationEmailTpl`
&activationEmailSubject=`Thanks for Registering!`
&submittedResourceId=`97`
&usergroups=`Protected:Member`
&validate=`nospam:blank,
username:required:minLength=^6^,
password:required:minLength=^6^,
password_confirm:password_confirm=^password^,
fullname:required,
email:required:email`
&placeholderPrefix=`reg.`
&postHooks=`hookComEmail`
]]<?php
$message = 'A new user has signed up: '.$hook->getValue('username')
. ' with email '.$hook->getValue('email').'.';
$modx->getService('mail', 'mail.modPHPMailer');
$modx->mail->set(modMail::MAIL_BODY,$message);
$modx->mail->set(modMail::MAIL_FROM,'my email address');
$modx->mail->set(modMail::MAIL_FROM_NAME,'Name would go here');
$modx->mail->set(modMail::MAIL_SENDER,'Sender would go here');
$modx->mail->set(modMail::MAIL_SUBJECT,'New User Signed Up');
$modx->mail->address('to','my email address');
$modx->mail->setHTML(true);
if (!$modx->mail->send()) {
$modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$err);
}
$modx->mail->reset();
/* tell our snippet we're good and can continue */
return true;[2015-01-29 10:35:16] (ERROR @ /connectors/index.php) Could not get table class for class: modAccess
[2015-01-29 10:35:16] (ERROR @ /connectors/index.php) Could not get table name for class: modAccess
[2015-01-29 10:35:16] (ERROR @ /connectors/index.php) Error 42000 executing statement:
Array
(
[0] => 42000
[1] => 1038
[2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name.
)
[2015-01-29 10:35:50] (ERROR @ /index.php) An error occurred while trying to send the email:
[2015-01-29 10:38:12] (ERROR @ /connectors/index.php) Could not get table class for class: modAccess
[2015-01-29 10:38:12] (ERROR @ /connectors/index.php) Could not get table name for class: modAccess
[2015-01-29 10:38:12] (ERROR @ /connectors/index.php) Error 42000 executing statement:
Array
(
[0] => 42000
[1] => 1038
[2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name.
)
[2015-01-29 10:39:51] (ERROR @ /index.php) An error occurred while trying to send the email: This question has been answered by BobRay. See the first response.
$modx->mail->setHTML(true);
$modx->mail->setHTML(true);
if (!$modx->mail->send()) {
$modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$err);
}
$modx->mail->reset();
/* tell our snippet we're good and can continue */
return true;$modx->mail->setHTML(true);
$sent = $modx->mail->send();
if ($sent) {
$output = 'Mail Sent';
} else {
$output = 'Mail Not Sent';
}
return $output;