setFrom('from@example.com', 'First Last'); $mail->addAddress('whoto@example.com', 'John Doe'); $mail->Subject = 'PHPMailer file sender'; $mail->Body = 'My message body'; //Attach the uploaded file if (!$mail->addAttachment($uploadfile, 'My uploaded file')) { $msg .= 'Failed to attach file ' . $_FILES['userfile']['name']; } if (!$mail->send()) { $msg .= 'Mailer Error: ' . $mail->ErrorInfo; } else { $msg .= 'Message sent!'; } } else { $msg .= 'Failed to move file to ' . $uploadfile; } } ?> PHPMailer Upload
Send this file: