i am using php email function i try many time to correct my email sending issue in spam but its continuesly going to spam but its being when i creating the html email but when i create the plain text email go to inbox not to spam i am confuse from this process here is my code.
i am try many time to do that but i am unsuccess many time i change the header but then also the email were going in spam of html content but the plan text email i going to inbox kindly help to achieve this.
$to = 'sufyan.viftech@gmail.com';
$subject = 'subject';
$body = '<table border="0" cellpadding="0" cellspacing="0" width="100%" class="m_5364616749455967748m_-8867064849319555428mcnBoxedTextBlock" style="min-width:100%">
<tbody class="m_5364616749455967748m_-8867064849319555428mcnBoxedTextBlockOuter">
<tr>
<td valign="top" class="m_5364616749455967748m_-8867064849319555428mcnBoxedTextBlockInner">
<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%" class="m_5364616749455967748m_-8867064849319555428mcnBoxedTextContentContainer">
<tbody><tr>
<td style="padding-top:9px;padding-left:18px;padding-bottom:9px;padding-right:18px">
<table border="0" cellspacing="0" class="m_5364616749455967748m_-8867064849319555428mcnTextContentContainer" width="100%" style="width:80%!important;background-color:#f7f7f7;margin:auto;max-width:400px;border:1px solid #d9d9d9">
<tbody style="width:80%"><tr style="width:80%">
<td valign="top" class="m_5364616749455967748m_-8867064849319555428mcnTextContent" style="padding:18px;color:#8a8b99;font-family:Helvetica;font-size:14px;font-weight:normal;line-height:125%;text-align:center">
<p style="color:#8a8b99;font-family:Helvetica;font-size:14px;font-weight:normal;line-height:125%;text-align:center;max-width:400px;word-wrap:break-word"><strong>".$msg."</strong></p>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table>';
$body .= '
<p style="font-size:13px;line-height:125%;text-align:center"><span style="font-size:13px"><span style="font-family:arial,helvetica neue,helvetica,sans-serif">Your private key gives access to your Mobilink account. <strong><span style="color:#463ce6">Save it! </span></strong><br>
This is the <span style="color:#463ce6"><strong>most secure method</strong></span> of saving your data.</span></span></p>
<p style="font-size:13px;line-height:125%;text-align:center"><span style="font-size:13px"><span style="font-family:arial,helvetica neue,helvetica,sans-serif">You account id: <strong><span style="color:#463ce6">".$userid."</span></strong></span></span></p>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table>
//code paste
</td>
</tr>
<tr>
<td valign="top" id="m_5364616749455967748m_-8867064849319555428templateBody"><table border="0" cellpadding="0" cellspacing="0" width="100%" class="m_5364616749455967748m_-8867064849319555428mcnButtonBlock" style="min-width:100%">
<tbody class="m_5364616749455967748m_-8867064849319555428mcnButtonBlockOuter">
<tr>
<td style="padding-top:18px;padding-right:18px;padding-bottom:18px;padding-left:18px" valign="top" align="center" class="m_5364616749455967748m_-8867064849319555428mcnButtonBlockInner">
<table border="0" cellpadding="0" cellspacing="0" class="m_5364616749455967748m_-8867064849319555428mcnButtonContentContainer" style="border-collapse:separate!important;border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0px;border-bottom-left-radius:0px;background-color:#463ce6">
<tbody>
<tr>
<td align="center" valign="middle" class="m_5364616749455967748m_-8867064849319555428mcnButtonContent" style="font-family:Arial;font-size:14px;background-color: #3c6f9b;padding:15px">
<a class="m_5364616749455967748m_-8867064849319555428mcnButton" title="LOGIN INTO MOBILINK" href="http://mobilink.io/dashboard/signin.php" style="font-weight:bold;letter-spacing:normal;line-height:100%;text-align:center;text-decoration:none;color:#ffffff" target="_blank" data-saferedirecturl="">LOGIN INTO MOBILINK</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="m_5364616749455967748m_-8867064849319555428mcnDividerBlock" style="min-width:100%">
<tbody class="m_5364616749455967748m_-8867064849319555428mcnDividerBlockOuter">
<tr>
<td class="m_5364616749455967748m_-8867064849319555428mcnDividerBlockInner" style="min-width:100%;padding:18px">
<table class="m_5364616749455967748m_-8867064849319555428mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;border-top-width:1px;border-top-style:solid;border-top-color:#eaeaea">
<tbody><tr>
<td>
<span></span>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="m_5364616749455967748m_-8867064849319555428mcnImageBlock" style="min-width:100%">
<tbody class="m_5364616749455967748m_-8867064849319555428mcnImageBlockOuter">
<tr>
<td valign="top" style="padding:0px" class="m_5364616749455967748m_-8867064849319555428mcnImageBlockInner">
<table align="left" width="100%" border="0" cellpadding="0" cellspacing="0" class="m_5364616749455967748m_-8867064849319555428mcnImageContentContainer" style="min-width:100%">
<tbody><tr>
<td class="m_5364616749455967748m_-8867064849319555428mcnImageContent" valign="top" style="padding-right:0px;padding-left:0px;padding-top:0;padding-bottom:0;text-align:center">
<img align="center" alt="" src="https://ci3.googleusercontent.com/proxy/FmUNPqCu--DZltz4pKkxYSOKDUUYizUcG47lTfbWIVdRl9OybimOALOgxUg0MUf3ujPgQrBrXV6rRwY9WbMcN-c=s0-d-e1-ft#https://static.mirocana.com/img/warning.png" width="60" style="max-width:60px;padding-bottom:0;display:inline!important;vertical-align:bottom" class="m_5364616749455967748m_-8867064849319555428mcnImage CToWUd">
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="m_5364616749455967748m_-8867064849319555428mcnTextBlock" style="min-width:100%">
<tbody class="m_5364616749455967748m_-8867064849319555428mcnTextBlockOuter">
<tr>
<td valign="top" class="m_5364616749455967748m_-8867064849319555428mcnTextBlockInner" style="padding-top:9px">
<table align="left" border="0" cellpadding="0" cellspacing="0" style="max-width:100%;min-width:100%" width="100%" class="m_5364616749455967748m_-8867064849319555428mcnTextContentContainer">
<tbody><tr>
<td valign="top" class="m_5364616749455967748m_-8867064849319555428mcnTextContent" style="padding:0px 18px 9px;font-size:12px;text-align:center">
<img src="https://mobilink.io/dashboard/images/logo_blue.png" width=45%>
<p style="font-size:12px;text-align:center">THOSE WHO HAVE THIS PRIVATE KEY HAVE ACCESS TO YOUR ACCOUNT<br>
IF YOU LOSE YOUR PRIVATE KEY YOU WILL NOT BE ABLE TO RESTORE YOUR ACCOUNT</p>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table></td>
</tr>
</tbody></table>';
// $msg = trim($body);
$headers = 'From: sufyan.viftech@gmail.com' . "\r\n" ;
$headers .='Reply-To: '. $to . "\r\n" ;
$headers .='X-Mailer: PHP/' . phpversion();
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
if(mail($to, $subject,$body,$headers)) {
echo('<br>'."Email Sent ;D ".'</br>');
}
else
{
echo("<p>Email Message delivery failed...</p>");
}