if (-e $tmp) { $picfilename = "".$AGENT."-".$AGENTid.".jpg"; print ("$picfilename\n"); $msg->attach( Type => 'image file/jpg', Path => $tmp, Filename => $picfilename, Disposition => 'attachment'); }