I have a multisites wordpress project in local (using docker), and I am using WP Mail SMTP plugin to handle sending emails.
I did configure the plugin with my mailtrap credentials, and everything is fine because I tested it and it worked, I received the email.
The problem is that when I use the wp_mail function I can't manage to send an email. After a long period of debugging I came across the error: Could not instantiate mail function, but I've searched and searched and I haven't found a solution.
Here is my code
$to = $email;
$subject = 'Welcome to our Website';
$message = 'Dear User, welcome to our website!';
$result = wp_mail($to, $subject, $message);
I hope someone have an idea about what's going on.