0
I am using Phpmailer to send a form and I would like the attached files when they arrived in the email destination, had the file name the email of the person from whom I send, and not the file name, I did several tests here but could not.
<input type="file" name="arquivo[]" multiple>
$email = strip_tags(trim($_POST['email']));
$arquivo = $_FILES['arquivo'];
if ($arquivo['size'][0] != 0) {
for ($i = 0; $i < count($arquivo ['tmp_name']); $i++) {
$mail->AddAttachment($arquivo ['tmp_name'][$i], $arquivo['name'][$i]);
}
}
What is your problem?
– Sam
When I put the code like this, it works $mail->Addattachment($file ['tmp_name'][$i], 'file name') But when I try $mail->Addattachment($file ['tmp_name'][$i], $email[$i]); the file only takes the first letter of the person’s email
– Sérgio Machado