Created
May 1, 2011 19:02
-
-
Save kracekumar/950746 to your computer and use it in GitHub Desktop.
mail not working
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $allowed_type=array('application/pdf'); | |
| $max_size=2097152; | |
| $upload_path="intern/"; | |
| function sendmail($name) | |
| { | |
| $name="intern"; | |
| $email=array("[email protected]","[email protected]","[email protected]","[email protected]","[email protected]"); | |
| global $allowed_type,$upload_path; | |
| $subject="New intern has uploaded Resume "; | |
| $headers="From :Intern Bot"; | |
| if (file_exists($upload_path.$name)) | |
| { | |
| $file=@fopen($upload_path/$name,"rb"); | |
| $data=fread($file,filesize($file)); | |
| fclose($file); | |
| $semi_rand=md5(time()); | |
| $mime_boundary="==Multipart_Boundary_x{$semi_rand}x"; | |
| $headers.="\nMIME-Version:1.0\n"."Content-Type:multipart/mixed;\n"."boundary=\"{$mime_boundary}\""; | |
| $message="$name Resume is submitted at". date("d/m/Y h:i:s a", time())."Download resume from site "."{$mime_boundary}\n"."Content-Type:text/plain;charset=\"iso-8859-1\n"."Content-Transfer-Encoding:7bit\n\n"; | |
| $data=chunk_split(base64_encode($data)); | |
| $message.="{$mime_boundary}\n"."Content-Type:{$allowed_type[0]};\n"."name=$file\n"."Content-Disposition:attachment;\n"."filename=\"{$file}\"\n"."Contnet-Transfer-Encoding:base64\n\n".$data."\n\n"."{$mime_boundary}\n"; | |
| if(mail("[email protected]",$subject,$message,$headers)) | |
| echo "mail sent"; | |
| } | |
| else | |
| { | |
| echo "mail not sent"; | |
| echo $message; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment