I'm new using php mail and I was trying to send an attachment with at least 1.5 Mb but it doesn't work, but for small size images it works. I've already configure my php.ini to higher values like upload_max_filesize, post_max_size, max_execution_time and max_input time. but still nothing works. I've been searching the net for some answers but still no possible solution. Can Anyone help me? thank you in advance
<?php
/* Set e-mail recipient */
$myemail = "test@yahoo.com";
//*** Get values form fields ***//
$contact = $_POST['contact'];
$strtitle = $_POST["txtSubject"];
$type = $_POST['type'];
$message = $_POST['txtDescription'];
$message = wordwrap($message, 70);
$message = "
<b> Contact No:</b> $contact <br><br>
<b>Description:</b><br>
$message <br>
<b>Type</b> : $type
";
//*** Uniqid Session ***//
$strSid = md5(uniqid(time()));
$strHeader = "";
$strHeader .= "MIME-Version: 1.0\n";
$strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
$strHeader .= "This is a multi-part message in MIME format.\n";
$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-type: text/html; charset=utf-8\n";
$strHeader .= "Content-Transfer-Encoding: 7bit\n\n";
$strHeader .= $message."\n\n";
// *** Attachment ***//
if($_FILES["fileAttach"]["name"] != "")
{
$strFilesName = $_FILES["fileAttach"]["name"];
$strFileName = ($_FILES["fileAttach"]["size"] < 1000000);
$strContent = chunk_split(base64_encode(file_get_contents($_FILES["fileAttach"]["tmp_name"])));
$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n";
$strHeader .= "Content-Transfer-Encoding: base64\n";
$strHeader .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
$strHeader .= $strContent."\n\n";
}
$flgSend = @mail($myemail,$strtitle,null,$strHeader); // @ = No Show Error //
if($flgSend)
{
echo "<script type='text/javascript'>
alert('Report Successfully Sent');window.location.href='Bug.php';
</script>";
// echo "Size: " . ($_FILES["fileAttach"]["size"]);
}
else
//Alert when Cannot connect to server
{
echo "<script type='text/javascript'>
alert('Report Failed to Send : Server Connection Timed Out');window.location.href='Bug.php';
</script>";
// echo "Size Failed: " . ($_FILES["fileAttach"]["size"]);
}
exit();
?>