我正在尝试设置 WooCommerce 并在结帐过程中遇到错误:“此网站上出现严重错误”。我已禁用所有插件并在子域上测试了全新的 WordPress 安装,但问题仍然存在。
[25-Sep-2024 11:11:23 UTC] PHP Fatal error: Uncaught Error: Call to undefined function PHPMailer\PHPMailer\mail() in /home/bontonst/public_html/wp-includes/PHPMailer/PHPMailer.php:881
Stack trace:
#0 /home/bontonst/public_html/wp-includes/PHPMailer/PHPMailer.php(1972): PHPMailer\PHPMailer\PHPMailer->mailPassthru()
#1 /home/bontonst/public_html/wp-includes/PHPMailer/PHPMailer.php(1693): PHPMailer\PHPMailer\PHPMailer->mailSend()
#2 /home/bontonst/public_html/wp-includes/PHPMailer/PHPMailer.php(1525): PHPMailer\PHPMailer\PHPMailer->postSend()
#3 /home/bontonst/public_html/wp-includes/pluggable.php(546): PHPMailer\PHPMailer\PHPMailer->send()
#4 /home/bontonst/public_html/wp-content/plugins/woocommerce/includes/emails/class-wc-email.php(741): wp_mail()
#5 /home/bontonst/public_html/wp-content/plugins/woocommerce/includes/emails/class-wc-email-new-order.php(112): WC_Email->send()
#6 /home/bontonst/public_html/wp-includes/class-wp-hook.php(324): WC_Email_New_Order->trigger()
#7 /home/bontonst/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#8 /home/bontonst/public_html/wp-includes/plugin.php(565): WP_Hook->do_action()
#9 /home/bontonst/public_html/wp-content/plugins/woocommerce/includes/class-wc-emails.php(172): do_action_ref_array()
#10 /home/bontonst/public_html/wp-includes/class-wp-hook.php(324): WC_Emails::send_transactional_email()
#11 /home/bontonst/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#12 /home/bontonst/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#13 /home/bontonst/public_html/wp-content/plugins/woocommerce/includes/class-wc-order.php(420): do_action()
#14 /home/bontonst/public_html/wp-content/plugins/woocommerce/includes/class-wc-order.php(253): WC_Order->status_transition()
#15 /home/bontonst/public_html/wp-content/plugins/woocommerce/includes/class-wc-order.php(365): WC_Order->save()
#16 /home/bontonst/public_html/wp-content/plugins/woocommerce/includes/gateways/bacs/class-wc-gateway-bacs.php(390): WC_Order->update_status()
#17 /home/bontonst/public_html/wp-content/plugins/woocommerce/src/StoreApi/Legacy.php(54): WC_Gateway_BACS->process_payment()
#18 /home/bontonst/public_html/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\StoreApi\Legacy->process_legacy_payment()
#19 /home/bontonst/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#20 /home/bontonst/public_html/wp-includes/plugin.php(565): WP_Hook->do_action()
#21 /home/bontonst/public_html/wp-content/plugins/woocommerce/src/StoreApi/Utilities/CheckoutTrait.php(83): do_action_ref_array()
#22 /home/bontonst/public_html/wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Checkout.php(349): Automattic\WooCommerce\StoreApi\Routes\V1\Checkout->process_payment()
#23 /home/bontonst/public_html/wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractRoute.php(119): Automattic\WooCommerce\StoreApi\Routes\V1\Checkout->get_route_post_response()
#24 /home/bontonst/public_html/wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Checkout.php(138): Automattic\WooCommerce\StoreApi\Routes\V1\AbstractRoute->get_response_by_request_method()
#25 /home/bontonst/public_html/wp-includes/rest-api/class-wp-rest-server.php(1230): Automattic\WooCommerce\StoreApi\Routes\V1\Checkout->get_response()
#26 /home/bontonst/public_html/wp-includes/rest-api/class-wp-rest-server.php(1063): WP_REST_Server->respond_to_request()
#27 /home/bontonst/public_html/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch()
#28 /home/bontonst/public_html/wp-includes/rest-api.php(420): WP_REST_Server->serve_request()
#29 /home/bontonst/public_html/wp-includes/class-wp-hook.php(324): rest_api_loaded()
#30 /home/bontonst/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#31 /home/bontonst/public_html/wp-includes/plugin.php(565): WP_Hook->do_action()
#32 /home/bontonst/public_html/wp-includes/class-wp.php(418): do_action_ref_array()
#33 /home/bontonst/public_html/wp-includes/class-wp.php(813): WP->parse_request()
#34 /home/bontonst/public_html/wp-includes/functions.php(1336): WP->main()
#35 /home/bontonst/public_html/wp-blog-header.php(16): wp()
#36 /home/bontonst/public_html/index.php(17): require('/home/bontonst/...')
#37 {main}
thrown in /home/bontonst/public_html/wp-includes/PHPMailer/PHPMailer.php on line 881
我刚刚安装了 WP Mail SMTP 并且它可以工作。