php - how to attach multiple files to email in opencart -


i working on opencart module. want send multiple files download directory , send them attachment via email. have done code, doesn't send single email multiple attachments, sends multiple emails or sends 1 email last file name. here code.

$oresumectr = 0; $filepaths = array(); if (isset($this->request->post['selected']) && $this->validate_resume_email()) {         foreach ($this->request->post['selected'] $applicant_id) {         $resume_name = $this->model_catalog_career->getapplicantresume($applicant_id);         $upload_resume = $resume_name[0]['upload_resume'];         $filepaths[$oresumectr] = dir_download ."/resumes/" . $upload_resume;            $this->log->write('resume path name' .$filepaths);         $mail = new mail();         $mail->protocol = $this->config->get('config_mail_protocol');         $mail->hostname = $this->config->get('config_smtp_host');         $mail->username = $this->config->get('config_smtp_username');         $mail->password = $this->config->get('config_smtp_password');         $mail->port = $this->config->get('config_smtp_port');         $mail->timeout = $this->config->get('config_smtp_timeout');                      $mail->setto($this->request->get['emailid']);         $mail->setfrom($this->config->get('config_email'));         $mail->setsender('ifixandrepair.com');         $mail->setsubject("resume");         $message = '<p>please find attached resume. <br />thanks. </p><p>';         $mail->sethtml($message);         foreach($filepaths $filepath) {             if (isset($filepath) && file_exists($filepath)) {                 $mail->addattachment($filepath);            $this->log->write('resume path in side loop  ' .$filepath);             }              }         }                    $mail->send();          echo "<center>resume sent email address <b>" . $this->request->get['emailid'] ."</b> successfully.</center>"; } 


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -