How to allow specific extensions and file size to wp_mail attachment?

Add the following condition before the file upload functionality –

$allowedExts = array("pdf", "jpg", "png");

$temp = explode(".", $_FILES["attachment"]["name"]);
$extension = end($temp);

if ((($_FILES["file"]["type"] == "image/pdf")
|| ($_FILES["file"]["type"] == "image/jpg")
|| ($_FILES["file"]["type"] == "image/png"))
&& ($_FILES["file"]["size"] < 1000000)
&& in_array($extension, $allowedExts)) {
  //your file upload code and other stuffs
} else {
  echo "Invalid file";
}

Referred from http://www.w3schools.com/php/php_file_upload.asp

See ‘Restrictions on Upload’ section.