0

Hi In this script when users register on site they shoould receive confrimation email / code but the problem is users never receive it, I can activate it manually on mysql, there is stored activation key:

Here is script, what could be a problem?

/**
 * Sends activation email
 */
function notify_activation($user) {

  $app = \Slim\Slim::getInstance();
  
  $message = "Hello, <br>";
  
  $message .= '<br> To activate your <a href="'.app_url().'">' . get_config('appname') . '</a> account, please click the following link:<br>';
  
  $activation_link = app_url() . "/activate/" . $user->activation_token;
  
  $message .= '<a href="'.$activation_link.'">'.$activation_link.'</a>';

  $subject = get_config('appname') . " : Account Activation";
  
  mail($user->email, $subject, $message, get_notifier_headers(get_config('admin_email')));

}

Here is the full code: https://dl.dropboxusercontent.com/s/rwobyfjwvwny91m/phpfile.txt.txt

  • Assuming $user is an object with a property 'email' that is a properly formatted email, what does get_notifier_headers() do? And get_config()? Try hard-coding a couple of those things to see if your email works. You also should look into using phpMailer, but the way. – WillardSolutions Jan 03 '16 at 03:35
  • Well this came together with the script and get_notifier_header() is this: /** * Returns default email notifier headers */ function get_notifier_headers($from_email) { $headers = "Reply-To: $from_email\r\n"; $headers .= "Return-Path: $from_email\r\n"; $headers .= "From: $from_email\r\n"; $headers .= 'Organization: '.get_config('appname')."\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; return $headers; } –  Jan 03 '16 at 03:37
  • @EatPeanutButter I posted link with the full code abowe –  Jan 03 '16 at 03:38
  • I prefer not to dig through your full codebase. You should dump out a few of those values so you can make sure your code is doing what you think it's doing. Likely one of your variables is not parsing correctly – WillardSolutions Jan 03 '16 at 03:44
  • https://github.com/PHPMailer/PHPMailer link for PhpMailer, which gives you better debugging tools – WillardSolutions Jan 03 '16 at 03:46
  • @EatPeanutButter I am not good with these php codes, i was hoping for someone to help, something could be wrong and i wont notice it. And i dont know how to insert Phpmailer to send activation codes –  Jan 03 '16 at 03:46

0 Answers0