Home » Php » email – File format unknown while receiving mail through php mail uploaded file

email – File format unknown while receiving mail through php mail uploaded file

Posted by: admin February 25, 2020 Leave a comment

Questions:

I receiving mail with unknown file types like phpRNACKQ and so on. I have created the form in php and the code for uploading and sending file. The code is:

$mail = new Mail($this->config->get('config_mail_engine'));
        $mail->parameter = $this->config->get('config_mail_parameter');
        $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
        $mail->smtp_username = $this->config->get('config_mail_smtp_username');
        $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), 
ENT_QUOTES, 'UTF-8');
        $mail->smtp_port = $this->config->get('config_mail_smtp_port');
        $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
        $mail->setTo($this->config->get('config_email'));
        $mail->setFrom($this->config->get('config_email'));
        $mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
        $mail->setSubject(html_entity_decode($this->language->get('text_new_Seller'), ENT_QUOTES, 
'UTF-8'));
        //$mail->isHTML(true);
        $mail->SMTPSecure = 'ssl';
        $mail->setText($this->load->view('account/purpletree_multivendor/register_alertmail', 
$data));

$mail->addAttachment($this->request->files['pancardid']["tmp_name"]);
$mail->addAttachment($this->request->files['cancelchq']["tmp_name"]);
$mail->addAttachment($this->request->files['gstcopy']["tmp_name"]);
$mail->addAttachment($this->request->files['storefront']["tmp_name"]);
$mail->addAttachment($this->request->files['storeinside']["tmp_name"]);

What I was doing wrong and how to solve this???

How to&Answers: