anyone who can help me to add the code on how to send an HTML Structured Email with Attachment from Project folder using mail function in PHP.
Please review below code I constructed.
$mail_to = 'receiver@gmail.com';
$mail_subject = 'Sample Document Name';
$mail_headers = [
'MIME-Version' => '1.0',
'Content-Type' => 'text/html;charset=UTF-8',
'From' => 'PROJECT',
'Reply-To' => 'reply@gmail.com'
];
$mail_receiver_name = 'Sample Receiver Name';
$mail_document_type_name = 'Sample Document Type';
$mail_document_subject = 'Sample Subject';
$mail_document_number = 'Sample Document Number';
$mail_document_remarks = 'Sample Remarks';
ob_start();
require_once('mail_template.php');
$mail_message = ob_get_contents();
ob_end_clean();
$send = mail($mail_to, $mail_subject, $mail_message, $mail_headers);
$output = $send ? 'success' : 'success but email was not sent';
echo $output;