I'm using this codes and this does not give me any error and does not send any mail. Is there any notable issue with this? and it doesnt send via the SMTP details i gave. Im doing everything manually.
Could someone rewrite this codes to work with SMTP and the mistake I have done?
<?php
require_once "Mail.php";
$Subject=T rim(stripslashes($_POST[ 'Subject']));
$Name=T rim(stripslashes($_POST[ 'Name']));
$Email=T rim(stripslashes($_POST[ 'Email']));
$EmailMe='admin@mail.com' ;
$Message=T rim(stripslashes($_POST[ 'Message']));
$smtp=M ail::factory( 'smtp',
array( 'host'=> 'host',
'port' => '#port',
'auth' => true,
'username' =>
'mymail@mail.com',
'password' => '********'
));
$mail_user = "<html>
<body style='font-size: 120%;'>
<table width='100%' border='0' cellspacing='0' cellpadding='0' style='background:#e1f5fe;'>
<tr>
<td align='left' style='background:#2196F3;padding-left:5px;'><img src='path/to/image.png' width='50px' align='center' alt='' /><span style='color:#fff;font-size:20px;margin-top:5px;'>Title</span>
</td>
</tr>
</td>
<tr>
<td style='padding-left:5%;padding-right:5%'>
<p>Hi $Name,</p>
<p style='padding-left:3%;'>body for users</p>
<div style='background:#b3e5fc;'>
<p style='padding-left:1%;'>Message : </p>
<p style='padding-left:2%;padding-bottom:2px;'>$Message</p>
</div>
<p>Regards,</p>
<p style=''><b>Admin</b>
</p>
</td>
</tr>
</table>
<br>
</body>
</html>";
$mail_me = "<html>
<body style='font-size: 120%;'>
<table width='100%' border='0' cellspacing='0' cellpadding='0' style='background:#e1f5fe;'>
<tr>
<td align='left' style='background:#2196F3;padding-left:5px;'><img src='path/to/image.png' width='50px' align='center' alt='' /><span style='color:#fff;font-size:20px;margin-top:5px;'>Titile</span>
</td>
</tr>
</td>
<tr>
<td style='padding-left:5%;padding-right:5%'>
<p>Hi $Name,</p>
<p style='padding-left:3%;'>body for me</p>
<div style='background:#b3e5fc;'>
<p style='padding-left:1%;'>Message : </p>
<p style='padding-left:2%;padding-bottom:2px;'>$Message</p>
</div>
<p>Regards,</p>
<p style=''><b>Admin</b>
</p>
</td>
</tr>
$Email
</table>
<br>
</body>
</html>";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: ME <mymail@mail.com> \r\n";
$headers .= "Reply-To:
<admin@mail.com> \r\n";
$headers .= "Return-Path: mymail@mail.com";
$headers .= "X-Mailer: PHP \r\n";
$success = mail($Email, $Subject, $mail_user, $headers);
mail($EmailMe, $Subject, $mail_me, $headers);
if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=/thanks\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=/error\">";
}