• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Znote AAC - Nostalrius - Mail/Recovery Account error

Curb

Active Member
Joined
Sep 7, 2014
Messages
82
Solutions
5
Reaction score
34
Well Im trying to configure a mail server for my website but Im getting this error:
Code:
string(258) "SELECT `p`.`id` AS `player_id`, `a`.`name`, `a`.`id` AS `account_id` FROM `players` `p` INNER JOIN `accounts` `a` ON `p`.`account_id` = `a`.`id` WHERE `p`.`name` = 'Leroy Wisebeard' AND `a`.`email` = 'curb******@gmail.com' AND `a`.`name` = '8654286' LIMIT 1;"
(query - SQL error)
Type: select_single (select single row from database)

Unknown column 'a.name' in 'field list'

Config.php: (Im using godaddy)
Code:
    $config['mailserver'] = array(
        'register' => false, // Send activation mail
        'accountRecovery' => true, // Recover username or password through mail
        'host' => "smtpout.secureserver.net", // Outgoing mail server host.
        'securityType' => 'ssl', // ssl or tls
        'port' => 465, // SMTP port number - likely to be 465(ssl) or 587(tls)
        'email' => '********',
        'username' => 'suport******', // Likely the same as email
        'password' => '*****#', // The password.
        'debug' => true, // Enable debugging if you have problems and are looking for errors.
        'fromName' => $config['site_title'],
    );

Already installed the PHPMailer folder.
 
Solution
PHP:
<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

class Mail {
    protected $_config = false;

    /**
     * @param  array $config
     * @access public
     * @return void
    **/
    public function __construct($config) {
        $this->_config = $config;
    }

    /**
     * Sets the cache expiration limit (IMPORTANT NOTE: seconds, NOT ms!).
     *
     * @param  string $to, string $title, string $text, string $accname
     * @access public
     * @return boolean
    **/
    public function sendMail($to, $title, $text, $accname = '') {
        //SMTP needs accurate times, and the PHP time zone MUST be set
        //This...
Nostalrius doesn't have the account.name column (referred to as a.name in the query).
In order to simulate the a.name column, I suggest 2 changes in the SQL query:

In the SELECT part, change:
SQL:
`a`.`name`

with:
SQL:
`a`.`id` AS `name`

And at the end of the query after the last "AND" part, change:
SQL:
`a`.`name` =

with:
SQL:
`a`.`id` =
 
No more error. But it leads me to a blank page and no e-mail received.

And I also noticed something, when I set 'debug' => true, on the $config['mailserver'], people stop receving the congratulations message when creating a new account. (it does create the account perfectly but no message.)
 
Which web server are you using?

PHP errors might be omitted from the outputbuffer if your using Uniform Server, or a php configuration file set to production.
Reproduce the blank page, and post the tail end of your error.log file.

Directory is something along the lines of:
/var/log/nginx/error.log
/var/log/apache2/error.log
UniServerZ\core\apache2\logs\error.log

Where before you had an SQL error, I think now that script execution proceeded until an omitted PHP error occured.
 
Last edited:
Uniform Server:
Code:
[Mon Sep 23 17:48:56.127423 2019]

[php7:error] [pid 14848:tid 2104] [client 177.67.202.79:57272] PHP Fatal error:  require(): Failed opening required 'PHPMailer/PHPMailerAutoload.php' (include_path='.;C:/Otserv/UniServerZ/home/us_pear/PEAR') in C:\\Otserv\\UniServerZ\\www\\engine\\function\\mail.php on line 26, referer: http://187.255.139.170:8080/recovery.php?mode=username
 
Do you mind teach me how to apply? Sorry for my inexperience.

mail.php
PHP:
<?php
class Mail {
    protected $_config = false;

    /**
     * @param  array $config
     * @access public
     * @return void
    **/
    public function __construct($config) {
        $this->_config = $config;
    }

    /**
     * Sets the cache expiration limit (IMPORTANT NOTE: seconds, NOT ms!).
     *
     * @param  string $to, string $title, string $text, string $accname
     * @access public
     * @return boolean
    **/
    public function sendMail($to, $title, $text, $accname = '') {
        //SMTP needs accurate times, and the PHP time zone MUST be set
        //This should be done in your php.ini, but this is how to do it if you don't have access to that
        //date_default_timezone_set('Etc/UTC');

        require 'PHPMailer/PHPMailerAutoload.php';

        //Create a new PHPMailer instance
        $mail = new PHPMailer();

        //Tell PHPMailer to use SMTP
        $mail->isSMTP();

        //Enable SMTP debugging
        // 0 = off (for production use)
        // 1 = client messages
        // 2 = client and server messages
        $mail->SMTPDebug = ($this->_config['debug']) ? 2 : 0;

        //Ask for HTML-friendly debug output
        $mail->Debugoutput = 'html';

        //Set the hostname of the mail server
        $mail->Host = $this->_config['host'];

        //Set the SMTP port number - likely to be 25, 465 or 587
        $mail->Port = $this->_config['port'];

        //Whether to use SMTP authentication
        $mail->SMTPAuth = true;
        $mail->SMTPSecure = $this->_config['securityType'];

        //Username to use for SMTP authentication
        $mail->Username = $this->_config['username'];

        //Password to use for SMTP authentication
        $mail->Password = $this->_config['password'];

        //Set who the message is to be sent from
        $mail->setFrom($this->_config['email'], $this->_config['fromName']);

        //Set who the message is to be sent to
        $mail->addAddress($to, $accname);

        //Set the subject line
        $mail->Subject = $title;

        // Body
        $mail->Body = $text;

        // Convert HTML -> plain for legacy mail recievers
        // Create new lines instead of <br> html tags.
        $text = str_replace("<br>", "\n", $text);
        $text = str_replace("<br\>", "\n", $text);
        $text = str_replace("<br \>", "\n", $text);
        // Then get rid of the rest of the html tags.
        $text = strip_tags($text);

        //Replace the plain text body with one created manually
        $mail->AltBody = $text;


        //send the message, check for errors
        $status = false;
        if (!$mail->send()) {
            echo "Mailer Error: " . $mail->ErrorInfo;
            exit();
        } else {
            $status = true;
        }
        return $status;
    }
}

Just replace it all? Because if it is the whole website went off 😂
 
Last edited:
PHP:
<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

class Mail {
    protected $_config = false;

    /**
     * @param  array $config
     * @access public
     * @return void
    **/
    public function __construct($config) {
        $this->_config = $config;
    }

    /**
     * Sets the cache expiration limit (IMPORTANT NOTE: seconds, NOT ms!).
     *
     * @param  string $to, string $title, string $text, string $accname
     * @access public
     * @return boolean
    **/
    public function sendMail($to, $title, $text, $accname = '') {
        //SMTP needs accurate times, and the PHP time zone MUST be set
        //This should be done in your php.ini, but this is how to do it if you don't have access to that
        //date_default_timezone_set('Etc/UTC');

        require __DIR__.'/../../PHPMailer/src/Exception.php';
        require __DIR__.'/../../PHPMailer/src/PHPMailer.php';
        require __DIR__.'/../../PHPMailer/src/SMTP.php';

        //Create a new PHPMailer instance
        $mail = new PHPMailer();

        //Tell PHPMailer to use SMTP
        $mail->isSMTP();

        //Enable SMTP debugging
        // 0 = off (for production use)
        // 1 = client messages
        // 2 = client and server messages
        $mail->SMTPDebug = ($this->_config['debug']) ? 2 : 0;

        //Ask for HTML-friendly debug output
        $mail->Debugoutput = 'html';

        //Set the hostname of the mail server
        $mail->Host = $this->_config['host'];

        //Set the SMTP port number - likely to be 25, 465 or 587
        $mail->Port = $this->_config['port'];

        //Whether to use SMTP authentication
        $mail->SMTPAuth = true;
        $mail->SMTPSecure = $this->_config['securityType'];

        //Username to use for SMTP authentication
        $mail->Username = $this->_config['username'];

        //Password to use for SMTP authentication
        $mail->Password = $this->_config['password'];

        //Set who the message is to be sent from
        $mail->setFrom($this->_config['email'], $this->_config['fromName']);

        //Set who the message is to be sent to
        $mail->addAddress($to, $accname);

        //Set the subject line
        $mail->Subject = $title;

        // Body
        $mail->Body = $text;

        // Convert HTML -> plain for legacy mail recievers
        // Create new lines instead of <br> html tags.
        $text = str_replace("<br>", "\n", $text);
        $text = str_replace("<br\>", "\n", $text);
        $text = str_replace("<br \>", "\n", $text);
        // Then get rid of the rest of the html tags.
        $text = strip_tags($text);

        //Replace the plain text body with one created manually
        $mail->AltBody = $text;


        //send the message, check for errors
        $status = false;
        if (!$mail->send()) {
            echo "Mailer Error: " . $mail->ErrorInfo;
            exit();
        } else {
            $status = true;
        }
        return $status;
    }
}

This requires PHP version 5.5+
 
Solution
It worked!
I had this error Extension missing: openssl but then I found that I had to remove the semicolon ;extension=php_openssl.dll and it worked just perfect.

Thank you so much for your time @Znote ;)
 
@Znote iam 17 years iam need something in my wepsite I am not good in programming language Is it possible to help me in this I took mistakes in the site
Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in C:\xampp\htdocs\Stop\system\libs\phpmailer\PHPMailerAutoload.php on line 45
can help me @Znote you are the best in programming lanuage
An error occorred while sending email! Try again or contact with admin. Error:
Could not instantiate mail function.
please tell me what me make now
 
@Znote iam 17 years iam need something in my wepsite I am not good in programming language Is it possible to help me in this I took mistakes in the site
Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in C:\xampp\htdocs\Stop\system\libs\phpmailer\PHPMailerAutoload.php on line 45
can help me @Znote you are the best in programming lanuage
An error occorred while sending email! Try again or contact with admin. Error:
Could not instantiate mail function.
please tell me what me make now

Solution:
 
@Znote can say me what me make now i have all this but whera me change this

Thx @Znote You Are Best But iam take secound eror

Warning: require(C:\xampp\htdocs\Stop/system/libs/phpmailer/PHPMailerAutoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\Stop\system\functions.php on line 822

Fatal error
: require(): Failed opening required 'C:\xampp\htdocs\Stop/system/libs/phpmailer/PHPMailerAutoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\Stop\system\functions.php on line 822
 
The file C:\xampp\htdocs\Stop/system/libs/phpmailer/PHPMailerAutoload.php doesn't seem to exist?
Looks like PHPMailer is not installed properly
 
require SYSTEM . 'libs/phpmailer/PHPMailerAutoload.php';
$mailer = new PHPMailer();
$mailer->setLanguage('en', LIBS . 'phpmailer/language/');
}
i have eror here can help me pro please
@Znote
Warning: require(C:\xampp\htdocs\Stop/system/libs/phpmailer/PHPMailerAutoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\Stop\system\functions.php on line 822

Fatal error
: require(): Failed opening required 'C:\xampp\htdocs\Stop/system/libs/phpmailer/PHPMailerAutoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\Stop\system\functions.php on line 822

@Znote iam not see the file PHPMailerAutoload.php
in this PHPMailer
iam take screen from you see

@Znote can help me From That or not pro
 

Attachments

Back
Top