• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Message: mail(): Failed to connect to mailserver at "localhost" port 25, verify your

#1
A PHP Error was encountered
Severity: Warning
Message: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
Filename: libraries/Email.php
Line Number: 1902
Backtrace:
File: C:\xampp\htdocs\labexercise009\application\models\account_login_model.php
Line: 59
Function: send

File: C:\xampp\htdocs\labexercise009\application\controllers\Account_login.php
Line: 51
Function: block

File: C:\xampp\htdocs\labexercise009\application\controllers\Account_login.php
Line: 21
Function: run

File: C:\xampp\htdocs\labexercise009\index.php
Line: 315
Function: require_once



Model
Code:
<?php
class account_login_model extends CI_Model
{
  public function __construct()
  {
    parent::__construct();
    $this->load->database();
  }

  public function login($username, $password)
  {
    $condition_array = array(
      'acc_username' => $username,
      'acc_password' => $password
    );
    $rs = $this->db->get_where('accounts', $condition_array);

    return $rs->row_array() ?: false;

     }

  public function isBlocked($username)
  {
    $condition_array = array(
      'acc_username' => $username,
      'acc_isBlocked' => 1
    );
    $rs = $this->db->get_where('accounts', $condition_array);
    $row_count = count($condition_array);

    if ($row_count > 0) {
      return true;
    } else {
      return FALSE;
    }
  }

  public function block($username)
  {
    $this->load->library('email');

    $email = $this->account_lookup($username, 'acc_email');

    $this->email->from('[email protected]', 'Yahoo.com');
    $this->email->to($email);
    $this->email->subject('Account Blocked');

    $message = $this->load->view('account_blocked', null, TRUE);

    $this->email->message($message);
    $this->email->send();

    $this->db->where('acc_username', $username);
    return $this->db->update('accounts', array('acc_isBlocked' => 1));
  }

  public function account_lookup($username, $return)
  {
    $rs = $this->db->get_where('accounts', array('acc_username' => $username));
    $row = $rs->row();
    return $row->$return;
  }
}

[b]php.ini[/b]

Code:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP=smtp.mail.yahoo.com
; http://php.net/smtp-port
smtp_port=465

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = [email protected]

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

[b]sendmail.ini[/b]
Code:
[sendmail]

smtp_server=smtp.mail.yahoo.com ; smtp port (normally 25) smtp_port=465

; if your smtp server requires authentication, modify the following two lines

[email protected] auth_password=XXXXX
Reply

#2
In your sendmail.ini, write the smtp port in a separate line.

smtp_server=smtp.mail.yahoo.com
smtp_port=465

In your php.ini, comment out your settings for Win32. These are the `smtp`, `smtp_port`, `sendmail_from`. Then in the sendmail path, remove the extra param. Just use the path:
sendmail_path = "C:\xampp\sendmail\sendmail.exe"
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.