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

By dm - January 17, 2013

hi greg

thanks for the help, this is a fresh installation of 2.50 using the membership plugin and admin login alert (i disabled these and had the same issue)

i just set up mail logging and cms builder indeed trying to send out the mail (it leaves a copy of the mail in ougoing)... so i guess its a server issue but not sure where to start?

any tips on where to start on this would be greatly appreciated

many thanks

elliot

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 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']))