-
- 1,145 Posts
This is what I have that works
[[!Register? .... &postHooks=`notifyAdmin` ]]
//I place notifyAdmin at the very end.
notifyAdmin
$message = 'Hi, a new User 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,'[email protected]');
$modx->mail->set(modMail::MAIL_FROM_NAME,'myGmail Auto');
$modx->mail->set(modMail::MAIL_SENDER,'myGmail Auto');
$modx->mail->set(modMail::MAIL_SUBJECT,'New User Signed Up');
$modx->mail->address('to','[email protected]');
$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;
TinymceWrapper: Complete back/frontend content solution.
Harden your MODX site by
passwording your three main folders:
core, manager, connectors and renaming your
assets (thank me later!)
5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
-
- 24,544 Posts
Does the notifyAdmin snippet work when you use it outside of Register?
This could be a problem since Gmail may see the email as being sent from the site's domain rather than gmail.com:
Another thought: Gmail will silently drop *all* mail from some hosts. I had this problem with BlueHost. It's caused by the host forwarding all mail without running it through a spam filter first. It's part of the reason I set up Notify to send through Mandrill or Mailgun.
You could also try setting up QuickEmail with the same email field values you're using above, to see if that works.
This is a separate issue, but it may come into play if you get things working:
http://bobsguides.com/blog.html/2016/07/09/prevent-email-warning-from-gmail/
[ed. note: BobRay last edited this post 7 years, 8 months ago.]