Skip to main content

Send Email With Attachment(Mail Function)-Full Detail In Hindi





Hello friends kese ho aap sab ajj me apko ek send email with attachment  script ke bare me btane wala hu aap iska use karke apne website me ye function dal sakte ho.

Advantages of send mail with attachment-
Iska use karke koi b visitor apne kisi friend ko email bhej sakta hai wo be attachment ke sath
Is script ka use karke app niche di gye types ki files easily send kar sakte ho.
“pdf", "docx", "doc", "gif", "txt", "jpg", "png", " jpeg
App agar koi or formate ki file send karna chahte ho to aap easily use kar sakte ho


Steps-
1-sbse pehle aap index.php file bnaiye,is index file me apki html ki coding ayegi
Index.php file ko aap niche diye gye link se download kar sakte ho easily


<!doctype html>
    <head>
        <link href="style.css" rel="stylesheet" type="text/css"/>
<title>Gajabwap Web In Hindi </title>
    </head>
    <body><table>
       <form method="post" action="mail.php" enctype="multipart/form-data" class="attachment-form">
           <h1>Welcome Our Free Email Send Tool</h1>
            <tr><td><h1>Enter your email</h1><input type="email" name="email"/></td></tr><br>

          

          <center> <tr><td><h1>Enter your Message </h1><textarea name="msg" ></textarea></td></tr></center><br>
          
           <center> <tr>
<td><input type="file" name="attach"/><tr></td><br>
          <center>  <tr><td><input type="submit" value="Send"/></td></tr></center>
        </form>
     </table>

    </body>
</html>


2-ab apko mail.php file bnani hai yanha apki php coding ayegi
Mail.php file download karne ke liye niche diye gye link par click kare




     

Php Mail Function





<?php


error_reporting(E_ALL);


ini_set('display_errors', 1);


 if (isset($_FILES) && (bool) $_FILES) {


     $allowedExtensions = array("pdf", "docx", "doc", "gif", "txt", "jpg", "png", " jpeg ");


// Yanha app apni marji se or be formate dal sakte ho


    $files = array();


    foreach ($_FILES as $name => $file) {


        $file_name = $file['name'];


        $temp_name = $file['tmp_name'];


        $file_type = $file['type'];


        $path_parts = pathinfo($file_name);


        $ext = $path_parts['extension'];


        if (!in_array($ext, $allowedExtensions)) {


            die("File $file_name has the extensions $ext is not allowed");


        }


        array_push($files, $file);


    }


      $to = $_POST['email'];


    $from ="yourname@yourwebsite.com";


     $subject = "your subject here";


      $message = $_POST['msg'];


    $headers = "From: $from";


      $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 = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";


    $message .= "--{$mime_boundary}\n";


      for ($x = 0; $x < count($files); $x++) {


        $file = fopen($files[$x]['tmp_name'], "rb");


        $data = fread($file, filesize($files[$x]['tmp_name']));


        fclose($file);


        $data = chunk_split(base64_encode($data));


        $name = $files[$x]['name'];


        $message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"$name\"\n" .


                "Content-Disposition: attachment;\n" . " filename=\"$name\"\n" .


                "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";


        $message .= "--{$mime_boundary}\n";


    }


 $ok = mail($to,$subject, $message, $headers);


    if ($ok) {


        echo "


mail sent to $to!


";


    } else {


        echo "mail sending failed!


";


    }


}


?>



  






                           For Demo Purpose Visit sonuwap.ga/sendmail

Ab aap easily is script ko run karwa sakte ho apne website  se. 
Note –is script se mail aap  sirf server se he send kar sakte ho to plz is script ka server par run karo
Me ummid karta hu ki apko ye script achi lgi hogi agar apko script run karwane me oi be problem a rhe hai to aap mujse comment me swal puch sakte hai me apki puri help karunga
                                thank you



Comments

  1. very nice post about send email with attachment full details

    ReplyDelete
  2. nice post bro apne bhut he achi trah se explain kiya hai send mail with attchment ko nice post hai i like itt

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Download Vimeo Thumbnail With PHP

Vimeo Thumbnail Downloader Tool – Vimeo Video Ka Thumbnail Download Karein Aaj ke is tutorial mein hum Vimeo Thumbnail Downloader Tool ke baare mein jaanenge. Is tool ki help se hum Vimeo video URL se us video ki thumbnail image obtain kar sakte hain. Agar aap PHP, Web Development, HTML, CSS aur Online Tools banana seekh rahe hain, to ye ek useful PHP project example hai. Vimeo Thumbnail Downloader Kya Hai? Vimeo Thumbnail Downloader ek simple tool hai jisme user Vimeo video ka URL enter karta hai. Tool Vimeo video ID ko identify karta hai aur available thumbnail image ko display karta hai. Example Vimeo URL: https://vimeo.com/389063954 Is URL mein: 389063954 Vimeo video ID hai. Vimeo Thumbnail Downloader Kaise Work Karta Hai? Is PHP script mein mainly do functions use kiye gaye hain: 1. getVimeoId() Ye function Vimeo URL se video ID find karta hai. 2. getVimeoThumb() Ye function Vimeo video ID ke basis par thumbnail information retrieve karta hai aur available thumbnail...

How To Create Contact Form With Validation-Php & Html

How To Create Contact Form - Hello Friends Ajj Me Apko Btaunga   Ki Kis Prakar   Ham Apni Website Ke Liye Contact Form Bnana Sakta Hai.( By Using   Php Contact Form With Validation Script ) Contact Form Hmare Website Ke Liye Bhut He Jrruri Hota Hai.Contact Form Ke Help Se He User Apna Message Website Owner(Admin) Ko Bhej Sakte Hai. Ajj Me Apko Btane Wala Hu Ki Kis Parkar Ham Contact Form Banakar Apne Website Me Add Kar Sakte Hai Or Apni Website Ke Liye Contact Form Bana Sakte Hai Is Contact Form Me   Ham Php Mail Function() Ka Use Karege . Ab Jab Be Koi User Contact Form Me Apni Information ,Message Details Fill Karke Submit Karega To Uski Sare Information Website Admin Ke Email Id Par A Jaiyegi Jo Be Admin Dwara   Niche Diye Gye Code Me Setup Ki Hogi. Used Language- ·          HTML ·          Jquery ·          Php ...

How To Send Sms From Website Using Php-Textlocal SMS

Hello Friends Ajj Me Apko Btaunga Ki Kis Prakar Aap Apni Website Me Free Sms Send Ka Option Integrate Kar Sakte Ho. Bulk sms in India-Best company Iske Liye Apko Sabse Pehle   Https://Www.Textlocal.In/Signup Par Signup Karke Account Create Karna Hai.Ye Ek Achi bulk sms provider company hai ·          Account Create Hone Ke Bad Aap Apna Username And Password Enter Karke Apne Dashboard Me Login Ho Jaiye( textlocal login) ·          Yanha Apko Text Local Company Dwara 10 Meassge Free Testing Ke Liye Diye Jayege ·          Aap Sms Plan Buy Kar Sakte Ho Is Company Dwara Bhut He Kam Prize Me Sms Pakage,plan provide  Kiye Jate Hai Textlocal Price Plans –  index.php <?php if(isset($_POST['code']) &&  isset($_POST['mobile'])){ // Authorisation details. $username = "enter your textlocal account email id here"; $hash = "...