I have a custom product form inquiry create and all of its data are sent through AJAX. The problem is although I included the wp-load.php
file for wp functions and pluggable.php
file for wp_email
function, it still show an error:
Fatal Error: Call to undefined function wp_email()
This is my code for inquire.php inside a folder that sends the email inquiry:
require('../wp-load.php');
require('../wp-includes/pluggable.php');
$to = 'email@email.com';
$subject = 'Product Inquiries';
$message = '
<table width="99%" cellspacing="0" cellpadding="1" border="0" bgcolor="#eaeaea">
<tbody>
<tr>
<td>
<table width="100%" cellspacing="0" cellpadding="5" border="0" bgcolor="#ffffff"><tbody>
<tr bgcolor="#eaf2fa">
<td colspan="2"><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><strong>Name</strong></font></td>
</tr>
<tr bgcolor="#ffffff">
<td width="20"> </td>
<td><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px">'.$your_name.'</font> </td>
</tr>
<tr bgcolor="#eaf2fa">
<td colspan="2"><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><strong>Email Address</strong></font></td>
</tr>
<tr bgcolor="#ffffff">
<td width="20"> </td>
<td><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><a target="_blank" href="mailto:'.$your_email.'">'.$your_email.'</a></font>
</td>
</tr>
<tr bgcolor="#eaf2fa">
<td colspan="2"><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><strong>Phone</strong></font></td>
</tr>
<tr bgcolor="#ffffff">
<td width="20"> </td>
<td><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px">'.$your_phone.'</font> </td></tr>
<tr bgcolor="#eaf2fa">
<td colspan="2"><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><strong>Product Link</strong></font></td>
</tr>
<tr bgcolor="#ffffff">
<td width="20"> </td>
<td><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><a target="_blank" href="'.$prod_link.'">'.$prod_name.'</a></font></td>
</tr>
<tr bgcolor="#eaf2fa">
<td colspan="2"><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><strong>Message</strong></font></td>
</tr>
<tr bgcolor="#ffffff">
<td width="20"> </td>
<td><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px">'.$your_message.'</font>
</td>
</tr>
<tr bgcolor="#eaf2fa">
<td colspan="2"><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px"><strong>Referred By:</strong></font></td>
</tr>
<tr bgcolor="#ffffff">
<td width="20"> </td>
<td><font style="FONT-FAMILY:sans-serif;FONT-SIZE:12px">'.$referred_by.'</font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>';
wp_email($to,$subject,$message);
Please help guys.. thanks..
There indeed is no
wp_email
function. It’s calledwp_mail
.