Jump to content
hogava

SMTPPassword how stored in database?

Recommended Posts

Hello,

i need insert smtp setting from phpmyadmin. 

how i should edite SMTPPassword in tblconfiguration ?

md5?

thanks.

Share this post


Link to post
Share on other sites

You can use the DecryptPassword API function to decrypt it: https://developers.whmcs.com/api-reference/decryptpassword/

Something like this

<?php

include_once 'init.php';

$SMTPPassword = Capsule::table('tblconfiguration')->value('SMTPPassword');

$command = 'DecryptPassword';
$postData = array(
    'password2' => $SMTPPassword,
);

$results = localAPI($command, $postData);
print_r($results);

The code above is not tested, but something like that would work for you.

Share this post


Link to post
Share on other sites

But I want reverse of it. 

i have my gmail password and i need Encrypt password and then save it for SMTPPassword

Share this post


Link to post
Share on other sites

Thanks so much,

How should run this and get result. 

I saved it in PHP file and run it but i have 500 error.

Share this post


Link to post
Share on other sites

Sorry, I forgot to include Capsule. Use this:

<?php

use WHMCS\Database\Capsule;
require __DIR__ . '/init.php';

$gmailPassword = "MyPassword";

$command = 'EncryptPassword';
$postData = array(
    'password2' => $gmailPassword,
);

$results = localAPI($command, $postData);
print_r($results);

$results['password'] contains your password en encrypted format. You can insert this into the database like this:

<?php

use WHMCS\Database\Capsule;
require __DIR__ . '/init.php';

$gmailPassword = "MyPassword";

$command = 'EncryptPassword';
$postData = array(
    'password2' => $gmailPassword,
);

$results = localAPI($command, $postData);

$newPass = $results['password'];

$changePassword = Capsule::table('tblconfiguration')->where('setting', 'SMTPPassword')->update(['value' => $newPass]);

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated