WHMCS is a very powerful financial management system. Since I used WHMCS to connect SolusVM when building its cloud host, I found that I encountered many problems when using WHMCS. The first problem is that WHMCS switches to SMTP for sending letters. By default, you can use PHP of WHMCS to send letters, but most of the letters sent are thrown into the trash by major mail providers.

Therefore, WHMCS is best to use SMTP to send letters. However, one problem with WHMCS is that after setting up SMTP sending, you can not test it in advance like WordPress third-party SMTP sending, which leads to great resistance in debugging the problem. This article will share the problems and solutions I had in setting up WHMCS SMTP sending.

In addition, WHMCS also has a problem with scheduled task settings. If you install WHMCS on a virtual host, you need to add scheduled tasks to the virtual host. If you are installing it on a VPS host, you also need to set up Cron scheduled tasks in the VPS. If you don't pay attention to the PHP environment, using the default command directly will easily lead to non-execution.

WHMCS uses SMTP to send emails, Chinese localization, scheduled task settings, discount code settings and email template modification methods

In short, it is recommended to check the official documentation of WHMCS before using WHMCS, so that WHMCS low-level errors will not occur during use. For more information on how to use WHMCS, please refer to the special topic: WHMCS from beginner to proficient. More tutorials on WHMCS integration include:

  1. VestaCP and WHMCS integration tutorial - realize self-service activation of virtual host and sales of host space products
  2. WHMCS adds Alipay and WeChat payment, theme template modification method and PDF invoice garbled problem resolution
  3. Use SolusVM to set up a NAT VPS host on the server/VPS - integrate WHMCS to sell NAT VPS

PS: Updated on April 3, 2019, WHMCS open source payment gateway can be found here: WHMCS payment gateway - the installation and use of open source and free WHMCS Alipay, WeChat and Youzan plug-ins.

1. Sending emails via WHMCS SMTP

1.1  SMTP settings

website:

  1. HTTPS://wuwuwu.I wasn’t born yet.com/

After entering WHMCS, select "Mail" in "Settings", and then choose to use SMTP to send emails. Generally speaking, you can choose port 465 + SSL, as shown below:

Here I chose Gmail. For those who send a large amount of letters every day, it is recommended to use paid SMTP. For details, see: Domestic and foreign enterprise (domain name) mailbox summary.

1.2  Send error

There may be errors during testing and we can see them in the logs.

The detailed error is as follows:

Email Sending Failed – SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting (Subject: Confirm Your Registration)

1.3  Solve the problem

Generally speaking, port 25 has been basically closed by major hosting providers. Port 465 can be opened in the firewall by yourself. The command is as follows:

/sbin/iptables -I INPUT -p tcp --dport 465 -j ACCEPT
/sbin/iptables -I OUTPUT -p tcp --dport 465 -j ACCEPT

Save /etc/rc.d/init.d/iptables saveRestart service service iptables restart and check whether the port that needs to be opened takes effect?

/etc/init.d/iptables status

Then use SMTP's 465SSL connection method to send the message. If you install a CSF firewall, modify the PORTFLOOD configuration in the csf.conf file and add 465 in and out and it will be OK. Generally, the CSF firewall opens 465 inbound by default, but does not open outbound, so it needs to be configured. Save after modification, then csf -r, restart, and it will be OK.

The above method has not been solved by wzfou.com, so I added in configuration.php:

$smtp_debug = true;

At this time, you can see detailed error information. For Gmail, the following three link addresses are also required to resolve security restrictions. Especially the third one:

  1. HTTPS://security.Google.com/settings/security/activity?later=en&霹雳=1
  2. HTTPS://wuwuwu.Google.com/settings/U/1/security/less secure apps
  3. HTTPS://accounts.Google.com/no/0/display unlock cap too bad

Google will require verification for new device logins, and we can cancel it manually.

Finally, if the SSL sending method fails, you can use 587+TSL to send the message, as shown below:

WHMCS uses SMTP to send the message successfully.

WHMCS uses SMTP to send messages

2. Chinese translation of WHMCS

website:

  1. HTTPS://GitHub.com/Kane awk/WH MCs-cn-translations

Instructions:

1. Upload lang/chinese-cn.php to your whmcs_install_dir/lang/ path.
if you current use WHMCS v6.3.0 or higher, you should rename original chinese.php to chinese-tw.php manually. Because original chinese.php was a Traditional Chinese edition.

2. Upload admin/lang/chinese-cn.php to your whmcs_install_dir/admin_dir/lang/ path.
3. Sign out your admin account, then choose Chinese language on login page.
4. Click the "My Account", Change language to Chinese, Enter your admin password at "Confirm Password" line, at last click "Save Changes" button.
5. Goto "Setup > General Settings", click "Localisation" tab, set "Default Language" to Chinese, at last click "Save Changes" button.

For the effect of Chinese localization, see: qyfou.com, as shown below:

3. WHMCS scheduled task settings

After installing WHMCS, you will usually be given a code for a scheduled task, asking you to add:

php -q /home/wzfou.com/admin/cron.php

If it is a VPS host, please execute the following command:

crontab -e
php -q /home/wzfou.com/admin/cron.php

#如果不执行,请加上环境变量
01 1 * * * /usr/local/php/bin/php -q /home/wzfou.com/admin/cron.php

If it is a virtual host, taking Cpanel as an example, it can be added in the scheduled task.

If everything is normal, you can see the correct execution in the scheduled task status of WHMCS.

4. WHMCS discount code setting

The WHMCS discount code can be viewed in payment. Recurring discount code. Select this to enjoy discounts every time you renew.

WHMCS discount codes can be specially set for upgrades or downgrades.

5. WHMCS email template issues

In the process of using WHMCS, I encountered a situation where the email template was wrong and the email could not be sent. The solution was to learn to read the email log and then modify the email template myself.

6. WHMCS time zone (time) setting

The time on WHMCS is different from that set on the server. It is displayed according to its default time zone. Therefore, in order to make the time displayed by WHMCS consistent with your own time, you need to set the time zone in the configuration file.

Edit the configuration.php file and add at the end of the php block (?>)

date_default_timezone_set('Asia/Shanghai');

7. Summary

WHMCS is a very mature financial management system. Judging from my experience of using WHMCS and SolusVM, the official documentation of WHMCS is updated quickly and is very complete. On the contrary, the reference documentation of SolusVM is not only outdated, but also contains many errors.

If you encounter problems when setting up SMTP emails, discount code settings, email templates and scheduled tasks in WHMCS, you might as well take a look at the relevant logs of WHMCS. Detailed errors can be seen in the WHMCS logs, which facilitates our analysis. .

Leave a Reply