Loading ...
Sorry, an error occurred while loading the content.
 

Re: [bang-phpug] send email html page using php code

Expand Messages
  • jatinder kaur
    hi, The folloowing code for sending email to many users at the same time. check the { } and then can use
    Message 1 of 6 , Oct 11, 2006
      hi,
      The folloowing code for sending email to many users at the same time. check
      the { } and then can use
      *************************************************************888
      <body>
      <?php
      if(!$_FILES['file_upload']['name']=="")
      {
      $uploaddir="$_SERVER[DOCUMENT_ROOT]/admin/uploaded_files/";
      move_uploaded_file($_FILES['file_upload']['tmp_name'],$uploaddir.$_FILES['file_upload']['name'])
      or $error="Can

      not be uploaded";
      $error="File ".$_FILES['file_upload']['name']." Uploaded Successfully";
      $attachedfile=$_POST['attachedfile'];

      }



      if(isset($_POST['send_mail'])&&($_POST['send_mail']=="form1"))
      {
      $finalcontent=$_POST['content3'];

      $error = "";



      $finalcontent.="<br><hr>You Have an Attachment with this Email : <a href=
      http://www.vedicworld.org/admin/uploaded_files/".

      $attachedfile.">".$attachedfile."</a><hr><br>";


      $subject=$_POST['subject'];


      $region_email="your@...";


      $header = "Return-Path: " .$region_email . "\r\nFrom: " . $region_email
      ."\r\nX-Sender: " . $region_email .
      $header . "\rX-Mailer: XSINFOWAYS";
      $header .= "\rMIME-Version: 1.0\rContent-Type: text/html\r\n<table>";

      $matter=file_get_contents("$_SERVER[DOCUMENT_ROOT]/admin/groups/group_$_POST[group_name].php");

      $final_emails=explode(",",$matter);
      $arraycount=count($final_emails);
      for($u=0; $u<$arraycount; $u++)
      {

      $to=$final_emails[$u];
      //echo $to."<HR>";
      mail($to,$subject,$finalcontent,$header);
      }


      }
      ?>


      <form action="send_email.php?group_id=<?php echo
      $_GET['group_id'];?>&group_name=<?php echo $_GET['group_name'];?>"

      method="post" name="form1"><table width="774" border="0" align="center"
      cellpadding="8" class="numtext" bgcolor="#f5ebc3">
      <tr><td align="right"><a href="index.php">View Groups</a></td></tr>
      <td width="16%">
      <tr><td colspan="2"><?php echo "You are Sending the following mail to Group
      <font color=red size=3>".$_GET['group_name'];

      ?></font></td></tr>
      <tr>
      <td>Subject</td>
      <td width="72%"><input name="subject" type="text" size="50"> </td>
      </tr>
      <tr>
      <td valign="top"><p>Message </p>

      </p></td>
      <td><textarea cols="50" rows=15></textarea>
      </td>
      </tr>



      </td>
      </tr>
      <input type="hidden" name="send_mail" value="form1">
      <input type="hidden" name="group_name" value="<?php print
      $_GET['group_name']; ?>">
      <input type="hidden" name="attachedfile" value="<?php print
      $_FILES['file_upload']['name']; ?>">

      <tr valign="baseline">
      <td nowrap align="right"> </td>
      <td align="center" ><input name="submit" type="submit" value="Send
      Email" class="button"></td>
      </tr>

      </form>





      <?
      if(!$_FILES['file_upload']['name']=="")
      {
      ?>
      <script>
      alert("<? echo $error; ?>");
      history.go(-1);
      </script>
      <tr><td align="center" class="numtext3"> Attached File : <? echo
      $_FILES['file_upload']['name']; ?></td></tr>
      <? exit; } ?>


      <form action="send_email.php?group_id=<?php echo
      $_GET['group_id'];?>&group_name=<?php echo $_GET['group_name'];?>"

      method="post" enctype="multipart/form-data" name="form_upload">

      <tr>

      <td width="21%" align="left" >Select File to Attach  </td>
      <td width="43%" align="left"><input name="file_upload" type="file"></td>
      <input type="hidden" name="MAX_FILE_SIZE" size="5200000">
      <input type="hidden" name="group_name" value="<?php print
      $_GET['group_name']; ?>">

      <td width="36%" align="left"><input name="upload" type="submit"
      value="Attach File" class="button"></td>
      </tr>

      </form>
      </table>

      </html>


      On 10/11/06, pritesh loke <priteshloke@...> wrote:
      >
      > Hello
      > That means in mail($to,$subject,"demo.html","/atc/try.pdf",$from);
      > Correct
      >
      > Thank you.
      >
      > jatinder kaur <jatinderkaur100@... <jatinderkaur100%40gmail.com>>
      > wrote: by uploading file to a folder and then sending the complete path of
      > uploaded
      > file in the message
      >
      > On 10/10/06, pritesh loke <priteshloke@... <priteshloke%40yahoo.com>>
      > wrote:
      > >
      > > Hello
      > > PLs i need help fast i want send email html page and one pdf file to
      > > attach files.Can we do that with php code.
      > >
      > > Thank you.
      > >
      > >
      > > ---------------------------------
      > > Get your email and more, right on the new Yahoo.com <http://yahoo.com/><
      > http://yahoo.com/>
      > >
      > > [Non-text portions of this message have been removed]
      > >
      > >
      > >
      >
      > [Non-text portions of this message have been removed]
      >
      >
      >
      >
      >
      >
      > ---------------------------------
      > Do you Yahoo!?
      > Everyone is raving about the all-new Yahoo! Mail.
      >
      > [Non-text portions of this message have been removed]
      >
      >
      >


      [Non-text portions of this message have been removed]
    • ravi kiran
      Hi jatider, I am also working on the code for sending mail with attachment. Due to some minor problem i couldn t complete. Please try this and let me know once
      Message 2 of 6 , Oct 17, 2006
        Hi jatider,

        I am also working on the code for sending mail with attachment. Due to
        some minor problem i couldn't complete. Please try this and let me
        know once you could figure out the error.

        $to="abc@...";
        $boundary = "12344";
        $filetype = "image/jpeg";
        $flname = "test.jpg";
        $fp = fopen($flname, "rb");
        $filecontents=chunk_split(base64_encode(fread($fp,
        filesize($flname))));
        $msgcontent="<p>Hi ! This is a test message</p>";

        $mens = "--$boundary"."\r\n";
        $mens .= "Content-Transfer-Encoding: 7bits"."\r\n";
        $mens .= "Content-Type: text/html; charset='ISO-8859-1'"."\r\n";
        $mens .= $msgcontent."\r\n";
        $mens .= "--$boundary"."\r\n";

        $mens .= "Content-Type: ".$filetype."; name=".$flname."\r\n";
        $mens .= "Content-Disposition: attachment;
        filename=".$flname."\r\n"; //; filename=".$flname."\r\n"
        $mens .= "Content-Transfer-Encoding: base64".$filecontents."\r\n";
        $mens.= "--$boundary--"."\r\n";

        $headers = "MIME-Version: 1.0"."\r\n";
        $headers .= "Date: ".date("D, d M Y H:i:s O")."\r\n";
        $headers .= "From: $email_id"."\r\n";
        $headers .= "Content-Type: multipart/mixed;
        boundary=".$boundary."\r\n";

        Here I am trying to attach a jpeg file along with the html message,
        but i couldn't. Message is going only the problem is with the attachment.

        Regards,
        Ravi Kiran


        --- In bang-phpug@yahoogroups.com, "jatinder kaur"
        <jatinderkaur100@...> wrote:
        >
        > hi,
        > The folloowing code for sending email to many users at the same
        time. check
        > the { } and then can use
        > *************************************************************888
        > <body>
        > <?php
        > if(!$_FILES['file_upload']['name']=="")
        > {
        > $uploaddir="$_SERVER[DOCUMENT_ROOT]/admin/uploaded_files/";
        >
        move_uploaded_file($_FILES['file_upload']['tmp_name'],$uploaddir.$_FILES['file_upload']['name'])
        > or $error="Can
        >
        > not be uploaded";
        > $error="File ".$_FILES['file_upload']['name']." Uploaded
        Successfully";
        > $attachedfile=$_POST['attachedfile'];
        >
        > }
        >
        >
        >
        > if(isset($_POST['send_mail'])&&($_POST['send_mail']=="form1"))
        > {
        > $finalcontent=$_POST['content3'];
        >
        > $error = "";
        >
        >
        >
        > $finalcontent.="<br><hr>You Have an Attachment with this Email : <a
        href=
        > http://www.vedicworld.org/admin/uploaded_files/".
        >
        > $attachedfile.">".$attachedfile."</a><hr><br>";
        >
        >
        > $subject=$_POST['subject'];
        >
        >
        > $region_email="your@...";
        >
        >
        > $header = "Return-Path: " .$region_email . "\r\nFrom: " . $region_email
        > ."\r\nX-Sender: " . $region_email .
        > $header . "\rX-Mailer: XSINFOWAYS";
        > $header .= "\rMIME-Version: 1.0\rContent-Type: text/html\r\n<table>";
        >
        >
        $matter=file_get_contents("$_SERVER[DOCUMENT_ROOT]/admin/groups/group_$_POST[group_name].php");
        >
        > $final_emails=explode(",",$matter);
        > $arraycount=count($final_emails);
        > for($u=0; $u<$arraycount; $u++)
        > {
        >
        > $to=$final_emails[$u];
        > //echo $to."<HR>";
        > mail($to,$subject,$finalcontent,$header);
        > }
        >
        >
        > }
        > ?>
        >
        >
        > <form action="send_email.php?group_id=<?php echo
        > $_GET['group_id'];?>&group_name=<?php echo $_GET['group_name'];?>"
        >
        > method="post" name="form1"><table width="774" border="0" align="center"
        > cellpadding="8" class="numtext" bgcolor="#f5ebc3">
        > <tr><td align="right"><a href="index.php">View Groups</a></td></tr>
        > <td width="16%">
        > <tr><td colspan="2"><?php echo "You are Sending the following mail
        to Group
        > <font color=red size=3>".$_GET['group_name'];
        >
        > ?></font></td></tr>
        > <tr>
        > <td>Subject</td>
        > <td width="72%"><input name="subject" type="text"
        size="50"> </td>
        > </tr>
        > <tr>
        > <td valign="top"><p>Message </p>
        >
        > </p></td>
        > <td><textarea cols="50" rows=15></textarea>
        > </td>
        > </tr>
        >
        >
        >
        > </td>
        > </tr>
        > <input type="hidden" name="send_mail" value="form1">
        > <input type="hidden" name="group_name" value="<?php print
        > $_GET['group_name']; ?>">
        > <input type="hidden" name="attachedfile" value="<?php print
        > $_FILES['file_upload']['name']; ?>">
        >
        > <tr valign="baseline">
        > <td nowrap align="right"> </td>
        > <td align="center" ><input name="submit" type="submit" value="Send
        > Email" class="button"></td>
        > </tr>
        >
        > </form>
        >
        >
        >
        >
        >
        > <?
        > if(!$_FILES['file_upload']['name']=="")
        > {
        > ?>
        > <script>
        > alert("<? echo $error; ?>");
        > history.go(-1);
        > </script>
        > <tr><td align="center" class="numtext3"> Attached File : <? echo
        > $_FILES['file_upload']['name']; ?></td></tr>
        > <? exit; } ?>
        >
        >
        > <form action="send_email.php?group_id=<?php echo
        > $_GET['group_id'];?>&group_name=<?php echo $_GET['group_name'];?>"
        >
        > method="post" enctype="multipart/form-data" name="form_upload">
        >
        > <tr>
        >
        > <td width="21%" align="left" >Select File to Attach  </td>
        > <td width="43%" align="left"><input name="file_upload"
        type="file"></td>
        > <input type="hidden" name="MAX_FILE_SIZE" size="5200000">
        > <input type="hidden" name="group_name" value="<?php print
        > $_GET['group_name']; ?>">
        >
        > <td width="36%" align="left"><input name="upload" type="submit"
        > value="Attach File" class="button"></td>
        > </tr>
        >
        > </form>
        > </table>
        >
        > </html>
        >
        >
        > On 10/11/06, pritesh loke <priteshloke@...> wrote:
        > >
        > > Hello
        > > That means in mail($to,$subject,"demo.html","/atc/try.pdf",$from);
        > > Correct
        > >
        > > Thank you.
        > >
        > > jatinder kaur <jatinderkaur100@... <jatinderkaur100%40gmail.com>>
        > > wrote: by uploading file to a folder and then sending the complete
        path of
        > > uploaded
        > > file in the message
        > >
        > > On 10/10/06, pritesh loke <priteshloke@... <priteshloke%40yahoo.com>>
        > > wrote:
        > > >
        > > > Hello
        > > > PLs i need help fast i want send email html page and one pdf file to
        > > > attach files.Can we do that with php code.
        > > >
        > > > Thank you.
        > > >
        > > >
        > > > ---------------------------------
        > > > Get your email and more, right on the new Yahoo.com
        <http://yahoo.com/><
        > > http://yahoo.com/>
        > > >
        > > > [Non-text portions of this message have been removed]
        > > >
        > > >
        > > >
        > >
        > > [Non-text portions of this message have been removed]
        > >
        > >
        > >
        > >
        > >
        > >
        > > ---------------------------------
        > > Do you Yahoo!?
        > > Everyone is raving about the all-new Yahoo! Mail.
        > >
        > > [Non-text portions of this message have been removed]
        > >
        > >
        > >
        >
        >
        > [Non-text portions of this message have been removed]
        >
      • jatinder kaur
        ravi, I will try latter and let u know. ... [Non-text portions of this message have been removed]
        Message 3 of 6 , Oct 17, 2006
          ravi,
          I will try latter and let u know.


          On 10/17/06, ravi kiran <l_ravikiran_2000@...> wrote:
          >
          > Hi jatider,
          >
          > I am also working on the code for sending mail with attachment. Due to
          > some minor problem i couldn't complete. Please try this and let me
          > know once you could figure out the error.
          >
          > $to="abc@... <abc%40abc.com>";
          > $boundary = "12344";
          > $filetype = "image/jpeg";
          > $flname = "test.jpg";
          > $fp = fopen($flname, "rb");
          > $filecontents=chunk_split(base64_encode(fread($fp,
          > filesize($flname))));
          > $msgcontent="<p>Hi ! This is a test message</p>";
          >
          > $mens = "--$boundary"."\r\n";
          > $mens .= "Content-Transfer-Encoding: 7bits"."\r\n";
          > $mens .= "Content-Type: text/html; charset='ISO-8859-1'"."\r\n";
          > $mens .= $msgcontent."\r\n";
          > $mens .= "--$boundary"."\r\n";
          >
          > $mens .= "Content-Type: ".$filetype."; name=".$flname."\r\n";
          > $mens .= "Content-Disposition: attachment;
          > filename=".$flname."\r\n"; //; filename=".$flname."\r\n"
          > $mens .= "Content-Transfer-Encoding: base64".$filecontents."\r\n";
          > $mens.= "--$boundary--"."\r\n";
          >
          > $headers = "MIME-Version: 1.0"."\r\n";
          > $headers .= "Date: ".date("D, d M Y H:i:s O")."\r\n";
          > $headers .= "From: $email_id"."\r\n";
          > $headers .= "Content-Type: multipart/mixed;
          > boundary=".$boundary."\r\n";
          >
          > Here I am trying to attach a jpeg file along with the html message,
          > but i couldn't. Message is going only the problem is with the attachment.
          >
          > Regards,
          > Ravi Kiran
          >
          > --- In bang-phpug@yahoogroups.com <bang-phpug%40yahoogroups.com>,
          > "jatinder kaur"
          > <jatinderkaur100@...> wrote:
          > >
          > > hi,
          > > The folloowing code for sending email to many users at the same
          > time. check
          > > the { } and then can use
          > > *************************************************************888
          > > <body>
          > > <?php
          > > if(!$_FILES['file_upload']['name']=="")
          > > {
          > > $uploaddir="$_SERVER[DOCUMENT_ROOT]/admin/uploaded_files/";
          > >
          >
          > move_uploaded_file($_FILES['file_upload']['tmp_name'],$uploaddir.$_FILES['file_upload']['name'])
          > > or $error="Can
          > >
          > > not be uploaded";
          > > $error="File ".$_FILES['file_upload']['name']." Uploaded
          > Successfully";
          > > $attachedfile=$_POST['attachedfile'];
          > >
          > > }
          > >
          > >
          > >
          > > if(isset($_POST['send_mail'])&&($_POST['send_mail']=="form1"))
          > > {
          > > $finalcontent=$_POST['content3'];
          > >
          > > $error = "";
          > >
          > >
          > >
          > > $finalcontent.="<br><hr>You Have an Attachment with this Email : <a
          > href=
          > > http://www.vedicworld.org/admin/uploaded_files/".
          > >
          > > $attachedfile.">".$attachedfile."</a><hr><br>";
          > >
          > >
          > > $subject=$_POST['subject'];
          > >
          > >
          > > $region_email="your@...";
          > >
          > >
          > > $header = "Return-Path: " .$region_email . "\r\nFrom: " . $region_email
          > > ."\r\nX-Sender: " . $region_email .
          > > $header . "\rX-Mailer: XSINFOWAYS";
          > > $header .= "\rMIME-Version: 1.0\rContent-Type: text/html\r\n<table>";
          > >
          > >
          >
          > $matter=file_get_contents("$_SERVER[DOCUMENT_ROOT]/admin/groups/group_$_POST[group_name].php");
          > >
          > > $final_emails=explode(",",$matter);
          > > $arraycount=count($final_emails);
          > > for($u=0; $u<$arraycount; $u++)
          > > {
          > >
          > > $to=$final_emails[$u];
          > > //echo $to."<HR>";
          > > mail($to,$subject,$finalcontent,$header);
          > > }
          > >
          > >
          > > }
          > > ?>
          > >
          > >
          > > <form action="send_email.php?group_id=<?php echo
          > > $_GET['group_id'];?>&group_name=<?php echo $_GET['group_name'];?>"
          > >
          > > method="post" name="form1"><table width="774" border="0" align="center"
          > > cellpadding="8" class="numtext" bgcolor="#f5ebc3">
          > > <tr><td align="right"><a href="index.php">View Groups</a></td></tr>
          > > <td width="16%">
          > > <tr><td colspan="2"><?php echo "You are Sending the following mail
          > to Group
          > > <font color=red size=3>".$_GET['group_name'];
          > >
          > > ?></font></td></tr>
          > > <tr>
          > > <td>Subject</td>
          > > <td width="72%"><input name="subject" type="text"
          > size="50"> </td>
          > > </tr>
          > > <tr>
          > > <td valign="top"><p>Message </p>
          > >
          > > </p></td>
          > > <td><textarea cols="50" rows=15></textarea>
          > > </td>
          > > </tr>
          > >
          > >
          > >
          > > </td>
          > > </tr>
          > > <input type="hidden" name="send_mail" value="form1">
          > > <input type="hidden" name="group_name" value="<?php print
          > > $_GET['group_name']; ?>">
          > > <input type="hidden" name="attachedfile" value="<?php print
          > > $_FILES['file_upload']['name']; ?>">
          > >
          > > <tr valign="baseline">
          > > <td nowrap align="right"> </td>
          > > <td align="center" ><input name="submit" type="submit" value="Send
          > > Email" class="button"></td>
          > > </tr>
          > >
          > > </form>
          > >
          > >
          > >
          > >
          > >
          > > <?
          > > if(!$_FILES['file_upload']['name']=="")
          > > {
          > > ?>
          > > <script>
          > > alert("<? echo $error; ?>");
          > > history.go(-1);
          > > </script>
          > > <tr><td align="center" class="numtext3"> Attached File : <? echo
          > > $_FILES['file_upload']['name']; ?></td></tr>
          > > <? exit; } ?>
          > >
          > >
          > > <form action="send_email.php?group_id=<?php echo
          > > $_GET['group_id'];?>&group_name=<?php echo $_GET['group_name'];?>"
          > >
          > > method="post" enctype="multipart/form-data" name="form_upload">
          > >
          > > <tr>
          > >
          > > <td width="21%" align="left" >Select File to Attach  </td>
          > > <td width="43%" align="left"><input name="file_upload"
          > type="file"></td>
          > > <input type="hidden" name="MAX_FILE_SIZE" size="5200000">
          > > <input type="hidden" name="group_name" value="<?php print
          > > $_GET['group_name']; ?>">
          > >
          > > <td width="36%" align="left"><input name="upload" type="submit"
          > > value="Attach File" class="button"></td>
          > > </tr>
          > >
          > > </form>
          > > </table>
          > >
          > > </html>
          > >
          > >
          > > On 10/11/06, pritesh loke <priteshloke@...> wrote:
          > > >
          > > > Hello
          > > > That means in mail($to,$subject,"demo.html","/atc/try.pdf",$from);
          > > > Correct
          > > >
          > > > Thank you.
          > > >
          > > > jatinder kaur <jatinderkaur100@... <jatinderkaur100%40gmail.com>>
          > > > wrote: by uploading file to a folder and then sending the complete
          > path of
          > > > uploaded
          > > > file in the message
          > > >
          > > > On 10/10/06, pritesh loke <priteshloke@... <priteshloke%40yahoo.com>>
          > > > wrote:
          > > > >
          > > > > Hello
          > > > > PLs i need help fast i want send email html page and one pdf file to
          > > > > attach files.Can we do that with php code.
          > > > >
          > > > > Thank you.
          > > > >
          > > > >
          > > > > ---------------------------------
          > > > > Get your email and more, right on the new Yahoo.com<http://yahoo.com/>
          > <http://yahoo.com/><
          > > > http://yahoo.com/>
          > > > >
          > > > > [Non-text portions of this message have been removed]
          > > > >
          > > > >
          > > > >
          > > >
          > > > [Non-text portions of this message have been removed]
          > > >
          > > >
          > > >
          > > >
          > > >
          > > >
          > > > ---------------------------------
          > > > Do you Yahoo!?
          > > > Everyone is raving about the all-new Yahoo! Mail.
          > > >
          > > > [Non-text portions of this message have been removed]
          > > >
          > > >
          > > >
          > >
          > >
          > > [Non-text portions of this message have been removed]
          > >
          >
          >
          >


          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.