<![CDATA[ Login snippet - admin notification - My Forums]]> https://forums.modx.com/thread/?thread=84980 <![CDATA[Re: Login snippet - admin notification]]> https://forums.modx.com/thread/84980/login-snippet---admin-notification#dis-post-543180
This could be a problem since Gmail may see the email as being sent from the site's domain rather than gmail.com:

$modx->mail->set(modMail::MAIL_FROM,'[email protected]');


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/]]>
BobRay Jul 11, 2016, 03:40 PM https://forums.modx.com/thread/84980/login-snippet---admin-notification#dis-post-543180
<![CDATA[Re: Login snippet - admin notification]]> https://forums.modx.com/thread/84980/login-snippet---admin-notification#dis-post-543172
Everything else is working perfectly... how can this be?

Error in error log (empty!):
[2016-07-11 12:06:26] (ERROR @ /var/sites/m/moorparknorthwoodhouses.forsale/public_html/core/cache/includes/elements/modsnippet/62.include.cache.php : 13) An error occurred while trying to send the email: 


Register code:
[[!Register?
    &submitVar=`registerbtn`
    &activationResourceId=`14`
    &activationEmailTpl=`ActivationEmailTpl`
    &activationEmailSubject=`Thanks for Registering!`
    &submittedResourceId=`13`
    &usergroups=`Members`
    &validate=`nospam:blank,
		username:required:minLength=^6^,
		password:required:minLength=^6^,
		password_confirm:password_confirm=^password^,
		fullname:required,
		email:required:email`
    &placeholderPrefix=`reg.`
    &successMsg=`Thanks for registering!`
    &postHooks=`notifyAdmin`
]]


notifyAdmin snippet:
$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;
]]>
ThaClown Jul 11, 2016, 06:10 AM https://forums.modx.com/thread/84980/login-snippet---admin-notification#dis-post-543172
<![CDATA[Re: Login snippet - admin notification]]> https://forums.modx.com/thread/84980/login-snippet---admin-notification#dis-post-468787
[[!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;
]]>
donshakespeare Jun 11, 2013, 11:04 AM https://forums.modx.com/thread/84980/login-snippet---admin-notification#dis-post-468787
<![CDATA[Login snippet - admin notification]]> https://forums.modx.com/thread/84980/login-snippet---admin-notification#dis-post-468741
the postHook works not sad
http://rtfm.modx.com/display/ADDON/Login.Using+Pre+and+Post+Hooks

i have login/register page.. everything works. but i want to send to admin an email also. Not only a bcc.. that works.

but i use "SMTP=Yes".. is that the reason, why the postHook
$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,'Jerrys Site');
$modx->mail->set(modMail::MAIL_SENDER,'Jerrys Site');
$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;


not works?

please help]]>
kossab Jun 11, 2013, 12:54 AM https://forums.modx.com/thread/84980/login-snippet---admin-notification#dis-post-468741