Rahat_Arif Posted February 16, 2023 Share Posted February 16, 2023 First of all Thank you all, My goal is to create a module that sends mail to anyone via PHPmailer using SMTP configuration. $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'mail.example.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'user@example.com'; // SMTP username $mail->Password = 'xxxxxxx'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 25; // TCP port to connect to $mail->From = 'from@example.com'; $mail->FromName = 'Mailer'; $mail->addAddress($address); // Add a recipient $mail->addReplyTo('info@example.com', 'Information'); $mail->addCC('cc@example.com'); $mail->addBCC('bcc@example.com'); Now for username and password, I need them to be dynamic, not manually entered. In that case, I would like to know where in the WHMCS database does this information get saved, since I have already checked the "tblconfiguration" table. Regards 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted February 16, 2023 Share Posted February 16, 2023 It's stored in tblconfiguration.value (setting name is SMTPPassword). Be advised the pssword is encrypted. You'll have to use Decrypt() function to use it in phpMailer. 1 Quote Link to comment Share on other sites More sharing options...
Rahat_Arif Posted February 16, 2023 Author Share Posted February 16, 2023 Thank you @Kian for your response, I already checked phpmyadmin for "SMTPPassword" but there is nothing about it. Can you tell me more about it, how can i get it. Regards 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted February 16, 2023 Share Posted February 16, 2023 You have to open tblconfiguration table. In this table you find SMTPPassword in setting column. The password is stored in value column (encrypted). 1 Quote Link to comment Share on other sites More sharing options...
Rahat_Arif Posted February 16, 2023 Author Share Posted February 16, 2023 Thank you @Kian for your reply 😊 I already check, I didn’t find anything about SMTPPassword. Maybe they change in Whmcs new version. Regards 0 Quote Link to comment Share on other sites More sharing options...
berstein Posted May 10, 2023 Share Posted May 10, 2023 Sir @Rahat_Arif The SMTP configuration is stored on "tblconfiguration" on column "setting" with the value of "MailConfig". Like sir @Kian said, you need to decrypt() the value of MailConfig. The decrypted value will return JSON containing SMTP setting. I'm currently using WHMCS 8.0. I hope this helps. 0 Quote Link to comment Share on other sites More sharing options...
ghsa Posted May 16, 2023 Share Posted May 16, 2023 @berstein The "Mail Provider" settings are not reflected in the `tblconfiguration` SMTP* fields (I believe this is from version 8.0 onwards). You can verify by setting the "SMTP Host" value and then checking `SMTPHost` in the DB. There are also many more "Mail Provider" options in UI than related fields in `tblconfiguration`. Does anyone know where to lookup the "Mail Provider" settings in WHMCS? I've done a complete dump of the database and grep of the file system and haven't been able to find them yet. 0 Quote Link to comment Share on other sites More sharing options...
ghsa Posted May 16, 2023 Share Posted May 16, 2023 When 'MailConfig' is decrypted, the structure is like: { "module": "SmtpMail", "configuration": { "encoding": "", "service_provider": "Generic", "host": "127.0.0.1", "port": "25", "auth_type": "plain", "username": "", "password": "", "oauth2_callback_url": "https://site/clients/admin/setup/mail/oauth2/callback", "oauth2_client_id": "", "oauth2_client_secret": "", "oauth2_refresh_token": "", "secure": "none", "debug": "" } } 0 Quote Link to comment Share on other sites More sharing options...
berstein Posted May 22, 2023 Share Posted May 22, 2023 @ghsa Is the "Mail Provider" you are looking the same "Mail Provider" in the "Configure Mail Provider" window? If yes, I think the "module" is what you are looking for since the options for mail providers are equal with the mail modules inside WHMCS. Please correct me if I'm wrong or if I misunderstand the question. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.