How to attach file in mail using php .? -
i have enquiry form takes primary details of user such name,address,email , resume.i want send uploaded resume administration's mail id , have used phpmyadmin class.my codes follows.
//codes// <?php require 'phpmailer/phpmailerautoload.php'; $allowedexts = array("docx", "pdf", "doc"); $temp = explode(".", $_files["upload"]["name"]); $extension = end($temp); if ((($_files["upload"]["type"] == "text/plain") || ($_files["upload"]["type"] == "application/doc") || ($_files["upload"]["type"] == "application/docx") || ($_files["upload"]["type"] == "application/pdf") )) { $file_to_attach= move_uploaded_file($_files["upload"]["tmp_name"], "cv/" . $_files["upload"]["name"]); } $bodytext='name:'.$varname. 'email:'.$varemail.'contact no:'.$varcontactnumber; $email = new phpmailer(); $email->from = 'you@example.com'; $email->fromname = 'your name'; $email->subject = 'message subject'; $email->body = $bodytext; $email->addaddress( 'info@impulseinfo.com' ); // $file_to_attach = '/cv'; $email->addattachment( $file_to_attach , 'nameoffile.pdf' ); $email->send(); header("location:careers.php?s_msg=your message send succesfully."); ?> not working.i not getting uploaded file attachments...is way or should opt other option.
Comments
Post a Comment