Password reminders / Emails not being sent

12 posts by 2 authors in: Forums > CMS Builder
Last Post: January 25, 2013   (RSS)

By dm - January 17, 2013 - edited: January 17, 2013

hi,

we have an issue with email on our cmsbuilder/server.

we are not receiving emails via the admin password reminder page and the alert admin login plugin which works with the membership plugin also isn't sending mail so i guess i have a bad setting somewhere.

my admin email address uses the same domain as the cms installation.

can anyone give me some hints on where to look to try and resolve this issue.

as far as i can see i have the admin email / server paths etc set up correctly in the general settings but no mail is being sent.

many thanks for you help!

Hi,

Which version of CMS Builder are you using? If it's 2.17 or 2.50 I would enable mail loggin under general settings, and then check the outgoing mail section to see if CMS Builder is trying to send mail. If it is, it's most likely a server issue. 

Has this suddenly started happening? Or have you changed anything recently, eg upgraded CMS Builder or upgraded a plugin.

One of the first things I would check is the $emailHeaders array on your user password request page. You could use the showme function to output its content:

showme($emailHeaders); 

This will allow you to check that everything looks correct , e.g, no missing e-mail addresses or incorrect file paths. 

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

Hi Elliot,

The first thing I would check is that the e-mails you are sending arn't appearing in your spam folder. 

If they arn't appearing in your spam folder I would create a really basic e-mail script to see if the PHP mail function on your server is working correctly. I would try the examples on this page:

http://php.net/manual/en/function.mail.php

If these arn't working, I would contact your hosting company and give them a URL/file path to your email test script.

Let me know if you have any questions, and how the testing goes.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By dm - January 18, 2013 - edited: January 18, 2013

hi greg

cheers for the info, nothing is going to spam so i set up a test email script which i have working on another site on the same hosting companies servers and it is not working here.

i should have tested that out first before coming here! sorry!

also just checked cmsbuilder install on this other site and the strange thing is even though the email script is working the cms installation password reminder on that site isn't working either (it had never been used so never noticed the error)

so kind of double confused now!

hopefully the hosting company will get back to me soon with fix and i can carry on developing the site..

many thanks for your help!

By dm - January 25, 2013

hi greg

we have had such a poor week with our webhost that we have jumped ship and set up somewhere new!

this has sorted the issue with the cms password reset not working and as per your advice i also have a basic mail script working fine no problems...

the alertAdminLogin plugin still doesnt seem to want to send any mail alerts out though...

do you know of any reason why this would not be working?

has anyone else here has experienced any problems using this plugin with 2.50?

would be nice to confirm the problem isn't between the pc and the chair!

many thanks for your help!

Hi,

Good to hear things are sorted with your hosting.

If the plug-in is activated and you have entered a valid e-mail address in the general settings,  I can't see anything that would stop it from working. I had a look at the plug-in code and it might be something to do with the mail function. I did a quick edit to the plug-in to use the CMS Builder sendMessage function instead, which has the benefit of logging messages if you have CMS Builder set up for that, this might help with finding the problem. I've attached a copy of it to this post. 

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com
Attachments:

alertadminlogin_003.php 2K

By dm - January 25, 2013

thanks for taking a look greg!

your attached plugin here seems to be identical to the original plugin file?

I've checked, and it looks to me as if my changes have been uploaded. You should see these changes starting at line 42 of the attached file:

//$mailResult = @mail($to, $subject, $message, "From: {$SETTINGS['adminEmail']}");

$mailResult = sendMessage(array(
  'from' => $SETTINGS['adminEmail'],
  'to' => $to,
  'subject' => $subject,
  'text' => $message
));

Greg Thomas







PHP Programmer - interactivetools.com

By dm - January 25, 2013

your quite right! sorry about that!!!

i have deactivated the previous version and removed it from the server then uploaded and activated your new edit however it does not appear to add a record in outgoing mail when logging into the client area...

one thing i omitted to mention in my previous post is that we are using the membership hack for the user logon time/ip address log as per:

http://www.interactivetools.com/forum/forum-posts.php?postNum=2217409#post2217409

http://www.interactivetools.com/forum/forum-posts.php?postNum=2213350#post2213350

could that be effecting the sending of alert email somehow?

i believe the only change in the membership plugin is the addition of the following lines:

// Save users last IP

$usersIpHasChanged = ($CURRENT_USER && $CURRENT_USER['last_ip'] != $_SERVER['REMOTE_ADDR']);
if ($usersIpHasChanged) {
mysql_update('accounts', $CURRENT_USER['num'], null, array('last_ip' => $_SERVER['REMOTE_ADDR']));
}

// CUSTOM CODE! add record to login_log

global $TABLE_PREFIX;
mysql_query(mysql_escapef("INSERT INTO {$TABLE_PREFIX}login_log SET createdDate = NOW(), who = ?, ip = ?", $CURRENT_USER['num'],$_SERVER['REMOTE_ADDR']))