How to send multiple attachment in single mail in php

前端 未结 3 743
故里飘歌
故里飘歌 2020-12-03 18:36

I would like to know about attaching multiple attachment in single mail and send . Please refer my following oode. In this only one file is getting attached. That is second

3条回答
  •  执笔经年
    2020-12-03 19:21

    For those who want to send multiple files using phpMailer and input file multiple. I joined and used the above two codes of @Rishi and @Matheno to achieve this result that dinamically add attachments selecteds by user.

    On your input file name remember to put brackets:

    
    

    On your php send file:

    Instead of:

    $mail->addAttachment('/var/tmp/file.tar.gz');
    

    Use:

    for($ct=0;$ctAddAttachment($_FILES['attach_file']['tmp_name'][$ct],$_FILES['attach_file']['name'][$ct]);
    }
    

提交回复
热议问题