Email Form Attachments

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HostGladiator
    Confirmed User
    • May 2005
    • 816

    #1

    Email Form Attachments

    Anyone know where I can get the code for attaching jpeg images in my email form on my site? Once I have that do I need to do anything else on the server or will the email and pictures be sent to my email inbox?

    Thanks
    HostGladiator- For All Your Hosting Needs!
    Linux Virtual Hosting, Budget VPS, Premium VPS and Dedicated Server Hosting
    24/7/365 Support- [email protected]
  • SmokeyTheBear
    ►SouthOfHeaven
    • Jun 2004
    • 28609

    #2
    u want an email form that allows attachments ? or for surfers to attach pics from your site ?
    hatisblack at yahoo.com

    Comment

    • marketsmart
      HOMICIDAL TROLL KILLER
      • Dec 2004
      • 20419

      #3
      you confused me....

      Comment

      • HostGladiator
        Confirmed User
        • May 2005
        • 816

        #4
        Originally posted by SmokeyTheBear
        u want an email form that allows attachments ? or for surfers to attach pics from your site ?
        I have a contact me form on my site for models to inquire about jobs. I would like for them to be able to attach pics to the email form when they email me.
        HostGladiator- For All Your Hosting Needs!
        Linux Virtual Hosting, Budget VPS, Premium VPS and Dedicated Server Hosting
        24/7/365 Support- [email protected]

        Comment

        • HostGladiator
          Confirmed User
          • May 2005
          • 816

          #5
          Originally posted by marketsmart
          you confused me....
          Sorry..
          HostGladiator- For All Your Hosting Needs!
          Linux Virtual Hosting, Budget VPS, Premium VPS and Dedicated Server Hosting
          24/7/365 Support- [email protected]

          Comment

          • SmokeyTheBear
            ►SouthOfHeaven
            • Jun 2004
            • 28609

            #6
            Originally posted by insomniac768
            I have a contact me form on my site for models to inquire about jobs. I would like for them to be able to attach pics to the email form when they email me.
            well heres one i premade you can cut and paste as you wish

            example

            http://tools.webspacemania.com/mailbear/

            save this as index.php
            Code:
            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
            <html>
            <head>
            <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
            <meta name="author" content="SmokeyBear">
            <meta name="generator" content="stb">
            <title>MailBear</title>
            <script language=javascript type='text/javascript'> 
            
            
            function sa() { 
            if (document.getElementById) { // DOM3 = IE5, NS6 
            document.getElementById('af').style.visibility = 'visible'; 
            } 
            else { 
            if (document.layers) { // Netscape 4 
            document.af.visibility = 'visible'; 
            } 
            else { // IE 4 
            document.all.af.style.visibility = 'visible'; 
            } 
            } 
            } 
            </script> 
            
            
            <style type="text/css">
            /*----------Text Styles----------*/
            .ws6 {font-size: 8px;}
            .ws7 {font-size: 9.3px;}
            .ws8 {font-size: 11px;}
            .ws9 {font-size: 12px;}
            .ws10 {font-size: 13px;}
            .ws11 {font-size: 15px;}
            .ws12 {font-size: 16px;}
            .ws14 {font-size: 19px;}
            .ws16 {font-size: 21px;}
            .ws18 {font-size: 24px;}
            .ws20 {font-size: 27px;}
            .ws22 {font-size: 29px;}
            .ws24 {font-size: 32px;}
            .ws26 {font-size: 35px;}
            .ws28 {font-size: 37px;}
            .ws36 {font-size: 48px;}
            .ws48 {font-size: 64px;}
            .ws72 {font-size: 96px;}
            .wpmd {font-size: 13px;font-family: 'Arial';font-style: normal;font-weight: normal;}
            /*----------Para Styles----------*/
            DIV,UL,OL /* Left */
            {
             margin-top: 0px;
             margin-bottom: 0px;
            }
            </style>
            
            <style type="text/css">
            div#container
            {
            	position:relative;
            	width: 778px;
            	margin-top: 0px;
            	margin-left: auto;
            	margin-right: auto;
            	text-align:left; 
            }
            body {text-align:center;margin:0}
            </style>
            </head>
            
            
            <body>
            
            <div id="container">
            <div id="image1" style="position:absolute; overflow:hidden; left:0px; top:0px; width:777px; height:136px; z-index:1"><img src="images/image241152359.jpg" border=0 width=777 height=136></div>
            
            <div id="text1" style="position:absolute; overflow:hidden; left:4px; top:6px; width:196px; height:42px; z-index:2">
            <div class="wpmd">
            <div><font class="ws26" color="#339966" face="Forte">STB</font></div>
            </div></div>
            
            <div id="text2" style="position:absolute; overflow:hidden; left:4px; top:42px; width:202px; height:44px; z-index:3">
            <div class="wpmd">
            <div><font class="ws9" color="#99CC00" face="Monotype Corsiva"><B>Version 4.20 </B></font></div>
            <div><font class="ws9" color="#99CC00" face="Monotype Corsiva"><B>Created by </B></font><font class="ws9" color="#FF0000" face="Monotype Corsiva"><B>SmokeyTheBear</B></font></div>
            </div></div>
            
            <form name="form1" method="POST" enctype="multipart/form-data"  action="stb.php">
            <input name="from" type="text" style="position:absolute;width:252px;left:93px;top:146px;z-index:5" value="[email protected]">
            <input name="to" type="text" style="position:absolute;width:252px;left:93px;top:173px;z-index:7" value="[email protected]">
            <input name="subject" type="text" style="position:absolute;width:252px;left:93px;top:201px;z-index:9" value="Checkout This Picture">
            <textarea name="message" style="position:absolute;width:424px;height:227px;left:353px;top:163px;z-index:11">Your message</textarea>
            <input name="Send" type="submit" value="   Send    " style="position:absolute;left:353px;top:396px;z-index:13">
            <input name="fileatt" type="file" style="position:absolute;width:253px;left:93px;top:228px;z-index:16">
            </form>
            
            <div id="text3" style="position:absolute; overflow:hidden; left:5px; top:150px; width:41px; height:16px; z-index:6">
            <div class="wpmd">
            <div><font color="#0000FF" face="Fixedsys">From:</font></div>
            </div></div>
            
            <div id="text4" style="position:absolute; overflow:hidden; left:4px; top:178px; width:41px; height:16px; z-index:8">
            <div class="wpmd">
            <div><font color="#0000FF" face="Fixedsys">To:</font></div>
            </div></div>
            
            <div id="text5" style="position:absolute; overflow:hidden; left:4px; top:206px; width:67px; height:16px; z-index:10">
            <div class="wpmd">
            <div><font color="#0000FF" face="Fixedsys">Subject:</font></div>
            </div></div>
            
            <div id="text6" style="position:absolute; overflow:hidden; left:352px; top:140px; width:67px; height:16px; z-index:12">
            <div class="wpmd">
            <div><font color="#0000FF" face="Fixedsys">Message:</font></div>
            </div></div>
            
            <div id="shape1" style="position:absolute; overflow:hidden; left:0px; top:140px; width:349px; height:116px; z-index:0; background-color:#C0C0C0">&nbsp;</div>
            
            <div id="image2" style="position:absolute; overflow:hidden; left:85px; top:257px; width:153px; height:166px; z-index:14"><img src="images/face.gif" border=0 width=153 height=166></div>
            
            <div id="image3" style="position:absolute; overflow:hidden; left:1px; top:425px; width:777px; height:27px; z-index:15"><img src="images/new_releases_s.gif" border=0 width=777 height=27></div>
            
            <div id="text7" style="position:absolute; overflow:hidden; left:3px; top:234px; width:90px; height:16px; z-index:17">
            <div class="wpmd">
            <div><font color="#0000FF" face="Fixedsys">Attach File</font></div>
            </div></div>
            
            
            </div>
            </body>
            </html>
            continued next post
            hatisblack at yahoo.com

            Comment

            • SmokeyTheBear
              ►SouthOfHeaven
              • Jun 2004
              • 28609

              #7
              save this as stb.php

              Code:
              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
              <html>
              <head>
              <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
              <meta name="generator" content="Web Page Maker V2">
              
              <style type="text/css">
              /*----------Text Styles----------*/
              .ws6 {font-size: 8px;}
              .ws7 {font-size: 9.3px;}
              .ws8 {font-size: 11px;}
              .ws9 {font-size: 12px;}
              .ws10 {font-size: 13px;}
              .ws11 {font-size: 15px;}
              .ws12 {font-size: 16px;}
              .ws14 {font-size: 19px;}
              .ws16 {font-size: 21px;}
              .ws18 {font-size: 24px;}
              .ws20 {font-size: 27px;}
              .ws22 {font-size: 29px;}
              .ws24 {font-size: 32px;}
              .ws26 {font-size: 35px;}
              .ws28 {font-size: 37px;}
              .ws36 {font-size: 48px;}
              .ws48 {font-size: 64px;}
              .ws72 {font-size: 96px;}
              .wpmd {font-size: 13px;font-family: 'Arial';font-style: normal;font-weight: normal;}
              /*----------Para Styles----------*/
              DIV,UL,OL /* Left */
              {
               margin-top: 0px;
               margin-bottom: 0px;
              }
              </style>
              
              <style type="text/css">
              div#container
              {
              	position:relative;
              	width: 778px;
              	margin-top: 0px;
              	margin-left: auto;
              	margin-right: auto;
              	text-align:left;
              }
              body {text-align:center;margin:0}
              </style>
              </head>
              
              <script language="JavaScript1.4" type="text/javascript">
              <!--
              function jsPlay(soundobj) {
               var thissound= eval("document."+soundobj);
               try {
                   thissound.Play();
               }
               catch (e) {
                   thissound.DoPlay();
               }
              }
              //-->
              </script>
              
              <script language="javascript" type="text/javascript">
              <!--
              function MM_swapImgRestore() {
                var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
              }
              
              function MM_preloadImages() {
                var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
                  var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
                  if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
              }
              
              function MM_findObj(n, d) {
                var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
                  d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
                if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
                for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
                if(!x && d.getElementById) x=d.getElementById(n); return x;
              }
              
              function MM_swapImage() {
                var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
                 if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
              }
              
              //-->
              </script>
              
              <body>
              
              <div id="container">
              <div id="image1" style="position:absolute; overflow:hidden; left:0px; top:0px; width:777px; height:136px; z-index:0"><img src="images/image241152359.jpg" border=0 width=777 height=136></div>
              
              <div id="text1" style="position:absolute; overflow:hidden; left:4px; top:6px; width:196px; height:42px; z-index:1">
              <div class="wpmd">
              <div><font class="ws26" color="#339966" face="Forte">Mailbear</font></div>
              </div></div>
              
              <div id="text2" style="position:absolute; overflow:hidden; left:4px; top:42px; width:202px; height:44px; z-index:2">
              <div class="wpmd">
              <div><font class="ws9" color="#99CC00" face="Monotype Corsiva"><B>Version 4.20 </B></font></div>
              <div><font class="ws9" color="#99CC00" face="Monotype Corsiva"><B>Created by </B></font><font class="ws9" color="#FF0000" face="Monotype Corsiva"><B>STB</B></font></div>
              </div></div>
              
              <div id="image3" style="position:absolute; overflow:hidden; left:1px; top:425px; width:777px; height:27px; z-index:3"><img src="images/new_releases_s.gif" border=0 width=777 height=27></div>
              
              <div id="image2" style="position:absolute; overflow:hidden; left:11px; top:144px; width:166px; height:114px; z-index:4"><img src="images/pic011.jpg" border=0 width=166 height=114></div>
              
              <div id="shape1" style="position:absolute; overflow:hidden; left:191px; top:143px; width:585px; height:275px; z-index:5; border:#808080 1px solid; background-color:#D4D4D4">&nbsp;</div>
              
              <div id="nav1" style="position:absolute; left:4px; top:267px; z-index:6"><a onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('nav10','','images/nav51141130a.gif',1)" href="index.html"><img name="nav10" onLoad="MM_preloadImages('images/nav51141130a.gif')" alt="" border=0 src="images/nav51141130i.gif"></a></div>
              
              <div id="text3" style="position:absolute; overflow:hidden; left:196px; top:148px; width:577px; height:86px; z-index:7">
              <div class="wpmd">
              <div>
                  <?php
                          //get data nedeed !
                          $from     = $_POST[from];
                          $to       = $_POST[to];
                          $subject  = $_POST[subject];
                          $message  = $_POST[message];
                          //replace \n with <br>
                          $message = str_replace("\n", "<br>",$message);
                          //report
                          echo "<b><font color=#8080FF> From: $from </b><br>";
                          echo "<b>To: $to </b><br>";
                          echo "<b>Subject: $subject</b><br><br></font>";
                          // Obtain file upload variables
                          $fileatt      = $_FILES['fileatt']['tmp_name'];
                          $fileatt_type = $_FILES['fileatt']['type'];
                          $fileatt_name = $_FILES['fileatt']['name'];
              
                          $headers = "From: $from  \n";
              
              
                         // if($_FILES['fileatt']['size'] > 0)
                         if (is_uploaded_file($fileatt)) {
                         // Read the file to be attached ('rb' = read binary)
                          $file = fopen($fileatt,'rb');
                          $data = fread($file,filesize($fileatt));
                          fclose($file);
                          // Generate a boundary string
                          $semi_rand = md5(time());
                          $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
                          // Add the headers for a file attachment
                          $headers .= "MIME-Version: 1.0\n" .
                                      "Content-Type: multipart/mixed;\n" .
                                      " boundary=\"{$mime_boundary}\"";
                          // Add a multipart boundary above the  message
                          $message = "This is a multi-part message in MIME format.\n\n" .
                          "--{$mime_boundary}\n" .
                          "Content-Type: text/html; charset=\"iso-8859-1\"\n" .
                          "Content-Transfer-Encoding: 7bit\n\n" .
                          $message . "\n\n";
              
                          // Base64 encode the file data
                          $data = chunk_split(base64_encode($data));
                           // Add file attachment to the message
                          $message .= "--{$mime_boundary}\n" .
                          "Content-Type: {$fileatt_type};\n" .
                          " name=\"{$fileatt_name}\"\n" .
                          //"Content-Disposition: attachment;\n" .
                          //" filename=\"{$fileatt_name}\"\n" .
                          "Content-Transfer-Encoding: base64\n\n" .
                          $data . "\n\n" .
                          "--{$mime_boundary}--\n";
                           }else echo "!  ";
              
                          //send the mail
                          if(mail($to, $subject, $message,$headers))echo "<b><font color=#FF0000>Message was sent!<b></font>";
                          else echo "<b><font color=#FF0000>Message error!<b></font>";
              
                    ?>
              </div>
              </div></div>
              
              <form name="form1">
              <textarea name="textarea1" style="position:absolute;width:573px;height:162px;left:197px;top:251px;z-index:9"><?=$_POST[message]?></textarea>
              </form>
              
              <div id="text4" style="position:absolute; overflow:hidden; left:197px; top:235px; width:63px; height:18px; z-index:10">
              <div class="wpmd">
              <div><font color="#0000FF"><B>Message:</B></font></div>
              </div></div>
              
              
              </div>
              </body>
              </html>
              You will have to copy the images yourself from my example page if you want to use them.. ( dont hotlink them )
              hatisblack at yahoo.com

              Comment

              • SmokeyTheBear
                ►SouthOfHeaven
                • Jun 2004
                • 28609

                #8
                the index.php is the mail form page the stb.php handles the input and is the page shown after mail is sent
                hatisblack at yahoo.com

                Comment

                • HostGladiator
                  Confirmed User
                  • May 2005
                  • 816

                  #9
                  Originally posted by SmokeyTheBear
                  the index.php is the mail form page the stb.php handles the input and is the page shown after mail is sent
                  Awesome... Thanks..
                  HostGladiator- For All Your Hosting Needs!
                  Linux Virtual Hosting, Budget VPS, Premium VPS and Dedicated Server Hosting
                  24/7/365 Support- [email protected]

                  Comment

                  • MaddCaz
                    Confirmed User
                    • Mar 2006
                    • 9483

                    #10
                    jigga que??

                    BigCocks.com -
                    MatureWomen.com -
                    Tranny.com -
                    DrunkGirls.com -
                    TeenGirls.com -
                    MonsterCock.com and
                    many more... Click
                    here to see them all!

                    Comment

                    Working...