Recently the hostingprovider has disabled for its customers sending forms with php mail(). Users can submit a form which looks like this, which always worked fine. How do i change this mail() to send with wp_mail(). I have already installed WP Mail SMTP which is working, but this is a custom form that has to be changed sending with wp_mail() instead of mail(). Thanks!
<?php
session_start();
if(!isset($_SESSION['set']))
{
$_SESSION['set'] = 1;
$oConnect = mysqli_connect('localhost', 'userlogin', 'userpass');
$content = str_replace(array_keys($replace), array_values($replace), $content);
//DATA pulled from DB
$to = $_POST['txt_email'];
$subject = 'Your request';
$headers = "From: info@domainexample.com\r\n";
$headers .= "Bcc: info@domainexmaple.com\r\n";
$headers .= "Reply-To: info@domainexample.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
// send mail
if(!empty($to)){
mail($to,$subject,$content,$headers);
}
}
?>