Wordpress wp_mail function crashing website

So i've been trying to send email from my functions.php script.

When wp_mail function is fired, my entire website crashes.

I have enabled all the error display settings in wp-config.

I literally copied and pasted the function directly from wordpress.org website, but still my email function causes crash.

 function send_email(){
        $from = Admin [email protected];
        $to = [email protected];
        $subject = Lamza Activation;
        $message = 'Testing 1 2 3';
        $headers[] = From: . $from . PHP_EOL;
        $headers[] = array('Content-Type: text/html; charset=UTF-8');
        wp_mail($to, $subject, $message, $headers);
    }

When i comment wp_mail, my website does not crash, if i uncomment wp_mail, my website crashes.

I do not know whats wrong. I can send test emails using Easy WP SMTP, so i know emails can be sent from my side.

Topic phpmailer wp-mail Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.