صفحة 1 من 2 12 الأخيرةالأخيرة
النتائج 1 إلى 15 من 19

الموضوع: ممكن طريقة "المرفقات" مع نموذج اتصل بنا

  1. #1
    عضو نشيط جدا
    تاريخ التسجيل
    Nov 2000
    المشاركات
    504

    ممكن طريقة "المرفقات" مع نموذج اتصل بنا



    السلام عليكم ورحمة الله وبركاته

    طلبي هو :

    طريقة المرفقات مع نموذج اتصل بنا إن امكن

    وشكراً للجميع







  2. #2
    عضو نشيط
    تاريخ التسجيل
    Oct 2003
    المشاركات
    280


    السلام عليكم
    شوف اخي
    هتعمل حقل لرفع المرفق واسمه مثلا upfile
    وطبعا انت عندك صفحة التحقق من المرسل ثم ارسال الرساله
    ضع هذا الكود قبل داله الارسال
    ملحوظه : المتغيرات mail_headers " غيره الى ما يخص متغير الهيدر حقك..
    mail_body غيره الى ما يخص تنسيق الرساله
    message هذا متغير الرساله كلها الذي تضعه في الداله . غيره كما هوه عندك


    كود PHP:
    if (isset($_FILES['file']))
        {
       
    $tmp_name $_FILES['file']['tmp_name'];
       
    $type $_FILES['file']['type'];
       
    $upfile $_FILES['file']['name'];
       
    $size $_FILES['file']['size'];

           
         if(
    is_uploaded_file($tmp_name)){
         
    $f 1;

            
    $file fopen($tmp_name,'rb');
            
    $data fread($file,filesize($tmp_name));
             
    fclose($file);
            
    $data chunk_split(base64_encode($data));

          
    $mail_headers .= "(anti-spam-content-type:) (anti-spam-multipart/mixed);\r\n" .
             
    " boundary=\"{$mime_boundary}\"";

          
    $message "توجد مرفقات مع هذه الرساله..\n\n" .
             
    "--{$mime_boundary}\n" .
             
    "(anti-spam-content-type:) text/html; charset=\"windows-1256\"\n" .
             
    "Content-Transfer-Encoding: 7bit\n\n" .
             
    $mail_body "\n\n";


          
    $message .= "--{$mime_boundary}\n" .
             
    "(anti-spam-content-type:) {$type};\n" .
             
    " name=\"{$name}\"\n" .
             
    "Content-Disposition: attachment;\n" .
             
    " filename=\"{$fileatt_name}\"\n" .
             
    "Content-Transfer-Encoding: base64\n\n" .
             
    $data "\n\n" .
             
    "--{$mime_boundary}--\n";
        
        }
        
        } 
    بالطبع هذا ما يخص المرفقات فقط .. اذا اردت الكود كاملا فاخبرني





    __________________
    سبحان الله وبحمده سبحان الله العظيم

    العضوية يستخدمها اكثر من شخص
    Nabeel A. Galal
    Hawk Eye
    nabeel.galal AT hotmail.com

  3. #3
    عضو نشيط جدا
    تاريخ التسجيل
    Nov 2000
    المشاركات
    504


    شكراً لك اخي الكريم

    راح اجربه وارد عليك






  4. #4
    عضو نشيط جدا
    تاريخ التسجيل
    Nov 2000
    المشاركات
    504


    كل المحاولات عندي فشلت

    ياليت توضح اكثر لي لانه

    لما اضبطته على الشكل المناسب لي تصل الرساله ويذكر ان فيها مرفقات ولاكن المرفقات لا تظهر وتظهر بدالها رموز غيربه
    مثل كذا
    NMvJx9uydujPP/+pAIdYQP/KWPaiA/bHBOPh3f//xXMzAP/UAJNKAPauBNXPyNilSbNgAP/fAPbS
    Art5APaHAPbZAP/SDNeED4pSEZdTBsagcezQNP/RKf/fOurDUPC/WP/XRruie/Hx8O/Ec+reC+ad






  5. #5
    عضو نشيط جدا
    تاريخ التسجيل
    Nov 2000
    المشاركات
    504


    حصلت كود ممكن يفيد الجميع

    وهو ضبط معاي ولله الحمد

    شكراً لك اخي الكريم على مساعدتك

    كود PHP:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>E-mail with Attachment</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <?php
       
    if ($_SERVER['REQUEST_METHOD']=="POST"){

       
    // we'll begin by assigning the To address and message subject
       
    $to="somebody@example.com";

       
    $subject="E-mail with attachment";

       
    // get the sender's name and email address
       // we'll just plug them a variable to be used later
       
    $from stripslashes($_POST['fromname'])."<".stripslashes($_POST['fromemail']).">";

       
    // generate a random string to be used as the boundary marker
       
    $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";

       
    // store the file information to variables for easier access
       
    $tmp_name $_FILES['filename']['tmp_name'];
       
    $type $_FILES['filename']['type'];
       
    $name $_FILES['filename']['name'];
       
    $size $_FILES['filename']['size'];

       
    // here we'll hard code a text message
       // again, in reality, you'll normally get this from the form submission
       
    $message "Here is your file: $name";

       
    // if the upload succeded, the file will exist
       
    if (file_exists($tmp_name)){

          
    // check to make sure that it is an uploaded file and not a system file
          
    if(is_uploaded_file($tmp_name)){

             
    // open the file for a binary read
             
    $file fopen($tmp_name,'rb');

             
    // read the file content into a variable
             
    $data fread($file,filesize($tmp_name));

             
    // close the file
             
    fclose($file);

             
    // now we encode it and split it into acceptable length lines
             
    $data chunk_split(base64_encode($data));
         }

          
    // now we'll build the message headers
          
    $headers "From: $from\r\n" .
             
    "(anti-spam-(anti-spam-mime-version:)) 1.0\r\n" .
             
    "(anti-spam-(anti-spam-content-type:)) (anti-spam-(anti-spam-multipart/mixed));\r\n" .
             
    " boundary=\"{$mime_boundary}\"";

          
    // next, we'll build the message body
          // note that we insert two dashes in front of the
          // MIME boundary when we use it
          
    $message "This is a multi-part message in MIME format.\n\n" .
             
    "--{$mime_boundary}\n" .
             
    "(anti-spam-(anti-spam-content-type:)) text/plain; charset=\"iso-8859-1\"\n" .
             
    "Content-Transfer-Encoding: 7bit\n\n" .
             
    $message "\n\n";

          
    // now we'll insert a boundary to indicate we're starting the attachment
          // we have to specify the content type, file name, and disposition as
          // an attachment, then add the file content and set another boundary to
          // indicate that the end of the file has been reached
          
    $message .= "--{$mime_boundary}\n" .
             
    "(anti-spam-(anti-spam-content-type:)) {$type};\n" .
             
    " name=\"{$name}\"\n" .
             
    //"Content-Disposition: attachment;\n" .
             //" filename=\"{$fileatt_name}\"\n" .
             
    "Content-Transfer-Encoding: base64\n\n" .
             
    $data "\n\n" .
             
    "--{$mime_boundary}--\n";

          
    // now we just send the message
          
    if (@mail($to$subject$message$headers))
             echo 
    "Message Sent";
          else
             echo 
    "Failed to send";
       }
    } else {
    ?>
    <p>Send an e-mail with an attachment:</p>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" 
       enctype="multipart/form-data" name="form1">
       <p>From name: <input type="text" name="fromname"></p>
       <p>From e-mail: <input type="text" name="fromemail"></p>
       <p>File: <input type="file" name="filename"></p>
       <p><input type="submit" name="Submit" value="Submit"></p>
    </form>
    <?php ?>
    </body>
    </html>







  6. #6
    عضو نشيط
    تاريخ التسجيل
    Oct 2003
    المشاركات
    280


    مبارك لك حل مشكتلك
    ولكن نفس الفكرتين متطابقة .. ربما لاني لم اضع النموذج كاملا فاصبح هناك خلل .. على العموم شكرا لك لوضعك الحل





    __________________
    سبحان الله وبحمده سبحان الله العظيم

    العضوية يستخدمها اكثر من شخص
    Nabeel A. Galal
    Hawk Eye
    nabeel.galal AT hotmail.com

  7. #7
    عضو نشيط جدا
    تاريخ التسجيل
    Nov 2000
    المشاركات
    504


    اخي الكريم hawkeye

    ممكن تساعدني بخصوص الكود اللي انا وضعته

    حصلت معاي مشكله وهي

    اولاً الكود ممتاز ويرسل المرفقات ولاكن لا يرسل الرساله الا اذا كانت تحتوي على مرفق

    وهذا مستحيل لان مو كل واحد راح يرسلي رساله راح يضع فيها مرفقات






  8. #8
    عضو نشيط جدا
    تاريخ التسجيل
    May 2007
    المشاركات
    509


    يا اخوان بما انو الموضوع مفتوح بخصوص الدالة mail وخواتها ... مين بعرف كيف نخلي الايمل يصل مباشرة على الانبوكس وبدون ما يروح على الجنك ميل .. بحثت بالانترنت وكل يوصي انو اذا بدي هالشي بس لازم استعمل STMP لارسال بريد يصل للانبوكس بدون مشاكل ... لكن ما اعرف كيف استعملو يعني ما كان كود عملي !!

    مين بقدر يساعدنا حبايبي ؟





    __________________
    EbNCaNa اخوكم ابن قانا

    [درس] قائمة بريدية بأسهل الطرق بواسطة PHP

    [توقيعك يجب أن لا يكون أطول من 400 حرف يتضمن تجاوز كود المنتدى] - الى متى المعاناة يا حضرة الأدارة ؟

  9. #9
    عضو نشيط
    تاريخ التسجيل
    Oct 2003
    المشاركات
    280


    كود PHP:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "http://www.w3.org/TR/html4/loose.dtd"> 
    <html> 
    <head> 
    <title>E-mail with Attachment</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
    </head> 
    <body> 
    <?php 
       
    if ($_SERVER['REQUEST_METHOD']=="POST"){ 

       
    // we'll begin by assigning the To address and message subject 
       
    $to="somebody@example.com"

       
    $subject="E-mail with attachment"

       
    // get the sender's name and email address 
       // we'll just plug them a variable to be used later 
       
    $from stripslashes($_POST['fromname'])."<".stripslashes($_POST['fromemail']).">"

       
    // generate a random string to be used as the boundary marker 
       
    $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x"

       
    // store the file information to variables for easier access 
       
    $tmp_name $_FILES['filename']['tmp_name']; 
       
    $type $_FILES['filename']['type']; 
       
    $name $_FILES['filename']['name']; 
       
    $size $_FILES['filename']['size']; 

       
    // here we'll hard code a text message 
       // again, in reality, you'll normally get this from the form submission 
       
    $message "Here is your file: $name"

       
    // if the upload succeded, the file will exist 
       
    if (file_exists($tmp_name)){ 

          
    // check to make sure that it is an uploaded file and not a system file 
          
    if(is_uploaded_file($tmp_name)){ 

             
    // open the file for a binary read 
             
    $file fopen($tmp_name,'rb'); 

             
    // read the file content into a variable 
             
    $data fread($file,filesize($tmp_name)); 

             
    // close the file 
             
    fclose($file); 

             
    // now we encode it and split it into acceptable length lines 
             
    $data chunk_split(base64_encode($data)); 
         } 

          
    // now we'll build the message headers 
          
    $headers "From: $from\r\n" 
             
    "(anti-spam-(anti-spam-(anti-spam-mime-version:))) 1.0\r\n" 
             
    "(anti-spam-(anti-spam-(anti-spam-content-type:))) (anti-spam-(anti-spam-(anti-spam-multipart/mixed)));\r\n" 
             
    " boundary=\"{$mime_boundary}\""

          
    // next, we'll build the message body 
          // note that we insert two dashes in front of the 
          // MIME boundary when we use it 
          
    $message "This is a multi-part message in MIME format.\n\n" 
             
    "--{$mime_boundary}\n" 
             
    "(anti-spam-(anti-spam-(anti-spam-content-type:))) text/plain; charset=\"iso-8859-1\"\n" 
             
    "Content-Transfer-Encoding: 7bit\n\n" 
             
    $message "\n\n"

          
    // now we'll insert a boundary to indicate we're starting the attachment 
          // we have to specify the content type, file name, and disposition as 
          // an attachment, then add the file content and set another boundary to 
          // indicate that the end of the file has been reached 
          
    $message .= "--{$mime_boundary}\n" 
             
    "(anti-spam-(anti-spam-(anti-spam-content-type:))) {$type};\n" 
             
    " name=\"{$name}\"\n" 
             
    //"Content-Disposition: attachment;\n" . 
             //" filename=\"{$fileatt_name}\"\n" . 
             
    "Content-Transfer-Encoding: base64\n\n" 
             
    $data "\n\n" 
             
    "--{$mime_boundary}--\n"

          
    // now we just send the message 
        
       
    }  
     if (@
    mail($to$subject$message$headers)) 
             echo 
    "Message Sent"
          else 
             echo 
    "Failed to send"
    } else { 
    ?> 
    <p>Send an e-mail with an attachment:</p> 
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"  
       enctype="multipart/form-data" name="form1"> 
       <p>From name: <input type="text" name="fromname"></p> 
       <p>From e-mail: <input type="text" name="fromemail"></p> 
       <p>File: <input type="file" name="filename"></p> 
       <p><input type="submit" name="Submit" value="Submit"></p> 
    </form> 
    <?php ?> 
    </body> 
    </html>
    اخي ابن قانا
    الكلاس المرفق جربه وهو سيعمل ان شاء الله





    الملفات المرفقة الملفات المرفقة
    __________________
    سبحان الله وبحمده سبحان الله العظيم

    العضوية يستخدمها اكثر من شخص
    Nabeel A. Galal
    Hawk Eye
    nabeel.galal AT hotmail.com

  10. #10
    عضو نشيط جدا
    تاريخ التسجيل
    Nov 2000
    المشاركات
    504


    للاسف اخي hawkeye

    الرساله تصل بدون مرفقات ولاكن الان المرفقات لا تصل بشكل صحيح وتظهر الرساله التالية


    كود PHP:
    This is a multi-part message in MIME format.

    --==
    Multipart_Boundary_x9106d146faec44478df75d022c232511x
    (anti-spam-(anti-spam-(anti-spam-(anti-spam-(anti-spam-content-type:))))) text/plaincharset="iso-8859-1"
    Content-Transfer-Encoding7bit

    Here is your file
    download.gif

    --==Multipart_Boundary_x9106d146faec44478df75d022c232511x
    (anti-spam-(anti-spam-(anti-spam-(anti-spam-(anti-spam-content-type:))))) image/gif;
     
    name="download.gif"
    Content-Transfer-Encodingbase64

    R0lGODlhFAAUALMAANjs1l28ZvD37064W3nEfMHhvuPx4oXJh7XcsqjWp8zmyje1Up3Sm2vAcQ2x
    S
    ////yH5BAAAAAAALAAAAAAUABQAAASH8EmJnL32zD1L++DHcKRinqZAbgmGEevEuFcTSwaj77py
    PwIeD/Cb0Rw2EoFopNkKiM1ikTs6DoAFbJINZGkLxZS4qTQqmHDAQea0Dq0LouGIxg6OBD6PH/3W
    CAkIFRoccBsCAQsFLQFueElcCxYBKht0DgMkAoKWGwMOkwMhpKSgYZNWR2ERADs
    =


    --==
    Multipart_Boundary_x9106d146faec44478df75d022c232511x-- 







  11. #11
    عضو نشيط جدا
    تاريخ التسجيل
    May 2007
    المشاركات
    509


    اخوي الطالب ممكن نعرف اي جزء مسؤول عن عدم اعتبار الرسالة سبام ... وبالتالي ارسالها للانبوكس ... ؟





    __________________
    EbNCaNa اخوكم ابن قانا

    [درس] قائمة بريدية بأسهل الطرق بواسطة PHP

    [توقيعك يجب أن لا يكون أطول من 400 حرف يتضمن تجاوز كود المنتدى] - الى متى المعاناة يا حضرة الأدارة ؟

  12. #12
    عضو نشيط جدا
    تاريخ التسجيل
    Nov 2000
    المشاركات
    504


    اخوي الطالب ممكن نعرف اي جزء مسؤول عن عدم اعتبار الرسالة سبام ... وبالتالي ارسالها للانبوكس ... ؟
    لا اعلم يا اخي و اللي يفيدك اكثر هو اللي وضع الكلاس الاخ hawkeye

    وياليت بعد يضوح لنا ماهو التعديل اللي قام به في الكود كاملاً






  13. #13
    عضو نشيط
    تاريخ التسجيل
    Oct 2003
    المشاركات
    280


    جرب الان اخي

    كود PHP:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
    "http://www.w3.org/TR/html4/loose.dtd">  
    <html>  
    <head>  
    <title>E-mail with Attachment</title>  
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">  
    </head>  
    <body>  
    <?php  
       
    if ($_SERVER['REQUEST_METHOD']=="POST"){  

       
    // we'll begin by assigning the To address and message subject  
       
    $to="somebody@example.com";  

       
    $subject="E-mail with attachment";  

       
    // get the sender's name and email address  
       // we'll just plug them a variable to be used later  
       
    $from stripslashes($_POST['fromname'])."<".stripslashes($_POST['fromemail']).">";  

       
    // generate a random string to be used as the boundary marker  
       
    $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";  

       
    // store the file information to variables for easier access  
       
    $tmp_name $_FILES['filename']['tmp_name'];  
       
    $type $_FILES['filename']['type'];  
       
    $name $_FILES['filename']['name'];  
       
    $size $_FILES['filename']['size'];  

       
    // here we'll hard code a text message  
       // again, in reality, you'll normally get this from the form submission  
       
    $message "Here is your file: $name";  
     
    $headers "From: $from\r\n" .  
             
    "(anti-spam-(anti-spam-(anti-spam-(anti-spam-mime-version:)))) 1.0\r\n" .  
             
    "(anti-spam-(anti-spam-(anti-spam-(anti-spam-content-type:)))) (anti-spam-(anti-spam-(anti-spam-(anti-spam-multipart/mixed))));\r\n" .  
             
    " boundary=\"{$mime_boundary}\"";  

          
    // next, we'll build the message body  
          // note that we insert two dashes in front of the  
          // MIME boundary when we use it  
          
    $message "This is a multi-part message in MIME format.\n\n" .  
             
    "--{$mime_boundary}\n" .  
             
    "(anti-spam-(anti-spam-(anti-spam-(anti-spam-content-type:)))) text/plain; charset=\"iso-8859-1\"\n" .  
             
    "Content-Transfer-Encoding: 7bit\n\n" .  
             
    $message "\n\n";  

       
    // if the upload succeded, the file will exist  
       
    if (file_exists($tmp_name)){  

          
    // check to make sure that it is an uploaded file and not a system file  
          
    if(is_uploaded_file($tmp_name)){  

             
    // open the file for a binary read  
             
    $file fopen($tmp_name,'rb');  

             
    // read the file content into a variable  
             
    $data fread($file,filesize($tmp_name));  

             
    // close the file  
             
    fclose($file);  

             
    // now we encode it and split it into acceptable length lines  
             
    $data chunk_split(base64_encode($data));  
         }  

          
    // now we'll build the message headers  
         
          // now we'll insert a boundary to indicate we're starting the attachment  
          // we have to specify the content type, file name, and disposition as  
          // an attachment, then add the file content and set another boundary to  
          // indicate that the end of the file has been reached  
          
    $message .= "--{$mime_boundary}\n" .  
             
    "(anti-spam-(anti-spam-(anti-spam-(anti-spam-content-type:)))) {$type};\n" .  
             
    " name=\"{$name}\"\n" .  
             
    //"Content-Disposition: attachment;\n" .  
             //" filename=\"{$fileatt_name}\"\n" .  
             
    "Content-Transfer-Encoding: base64\n\n" .  
             
    $data "\n\n" .  
             
    "--{$mime_boundary}--\n";  

        
         
       }     
    // now we just send the message  
     
    if (@mail($to$subject$message$headers))  
             echo 
    "Message Sent";  
          else  
             echo 
    "Failed to send";  
    } else {  
    ?>  
    <p>Send an e-mail with an attachment:</p>  
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"   
       enctype="multipart/form-data" name="form1">  
       <p>From name: <input type="text" name="fromname"></p>  
       <p>From e-mail: <input type="text" name="fromemail"></p>  
       <p>File: <input type="file" name="filename"></p>  
       <p><input type="submit" name="Submit" value="Submit"></p>  
    </form>  
    <?php ?>  
    </body>  
    </html>






    __________________
    سبحان الله وبحمده سبحان الله العظيم

    العضوية يستخدمها اكثر من شخص
    Nabeel A. Galal
    Hawk Eye
    nabeel.galal AT hotmail.com

  14. #14
    عضو نشيط
    تاريخ التسجيل
    Oct 2003
    المشاركات
    280


    اخي ابن قانا
    المواقع تختلف .. فمنها ما يتطلب تعديل في الهيدرز فقط ومنها ما يتطلب اكثر من ذلك
    فقط قم بتجربه الكلاس الذي ارفقته واذا عمل معك ساقوم بالشرح
    عذرا لضيق الوقت حاليا
    اخي الطالب .. الامر بسيط
    انت كنت تضع داله الارسال داخل شرط اذا كانت هناك مرفقات .. فقمت باخراجها من الشرط
    كذلك كنت تضع الهيدرز داخل الشرط فقمت باخراجهم .. قارن بين الكود المعدل والكود الذي وضعته انت وستعرف الفرق .





    __________________
    سبحان الله وبحمده سبحان الله العظيم

    العضوية يستخدمها اكثر من شخص
    Nabeel A. Galal
    Hawk Eye
    nabeel.galal AT hotmail.com

  15. #15
    عضو نشيط جدا
    تاريخ التسجيل
    Nov 2000
    المشاركات
    504


    نفس الخطأ بس بزياده

    في السابق كان يرسل بدون مرفقات ويصل بدون اخطأ الان يصل بظهور رساله
    --==Multipart_Boundary_xf22461145887a7f786ce1157f1f0ed2dx
    (anti-spam-(anti-spam-(anti-spam-(anti-spam-(anti-spam-content-type)))) text/plain; charset="iso-8859-1"
    Content-Transfer-Encoding: 7bit

    Here is your file:

    اما اذا ارسلت رساله بمرفق فيظهر نص طويل جد ولا يفهم منه اي شي










ضوابط المشاركة

  • لا تستطيع إضافة مواضيع جديدة
  • لا تستطيع الرد على المواضيع
  • لا تستطيع إرفاق ملفات
  • لا تستطيع تعديل مشاركاتك
  •  

أضف موقعك هنا| اخبار السيارات | حراج | شقق للايجار في الكويت | بيوت للبيع في الكويت | دليل الكويت العقاري | مقروء | شركة كشف تسربات المياه | شركة عزل اسطح بالرياض | عزل فوم بالرياض| عزل اسطح بالرياض | كشف تسربات المياة بالرياض | شركة عزل اسطح بالرياض