1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Help for Adding BCC field on email script

Discussion in 'Programming' started by robyries, Nov 24, 2015.

  1. #1
    Hi,..

    I just got this script from searching over uncle "G", it's email script. it's working just find. Currently I have an idea to add BCC field so I can sent more email.

    here the script
    <? include "../header.html" ?>
            <tr>
              <td valign="top" class="text">
                <p><span class="title">emailer</span></p>
    <p>
    <b>For Testing Purposes Only<br>
    <form action="mailed.php" method="post">
    Mail To: <input name="mailto" class='input_login' type="text" /><br>
    From: <input name="from" class='input_login' type="text" /> <br>
    Subject: <input name="subject" class='input_login' type="text" /><br>
    Body: <textarea name='body' class='input_body' rows='5' cols='55'></textarea><br>
    <input type="submit" class='input_login' value="Mail"/>
    </form>
    <p>
    <? include "../footer.html" ?>
    Code (markup):
    how can I add a BCC field, please help.

    thanks
     
    Solved! View solution.
    robyries, Nov 24, 2015 IP
  2. #2
    Hello,

    It is only a Form design in HTML. Where is the Programming code.

    You could do the same.
    <form action="mailed.php" method="post">
    Mail To: <input name="mailto" class='input_login' type="text" /><br>
    From: <input name="from" class='input_login' type="text" /> <br>
    BCC: <input name="bcc" class='input_login' type="text" /> <br>
    Subject: <input name="subject" class='input_login' type="text" /><br>
    Body: <textarea name='body' class='input_body' rows='5' cols='55'></textarea><br>
    <input type="submit" class='input_login' value="Mail"/>
    </form>


    Remember to put comma after every email in BCC Field.
    Now i am mentioning the codes of PHP.

    <?php
    $to = $_POST['mailto'];
    $from= $_POST['from'];
    $bcc= $_POST['bcc'];
    $subject= $_POST['subject'];
    $body= $_POST['body'];

    // To send HTML mail, the Content-type header must be set

    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .="Bcc: $bcc\r\n";

    // Create email headers

    $headers .= 'From: '.$from."\r\n".
    'Reply-To: '.$from."\r\n" .
    'X-Mailer: PHP/' . phpversion();


    // Sending email

    if(mail($to, $subject, $message, $headers)){
    echo '<script type="text/javascript">alert("Email sent successfully.");</script>';
    } else{
    echo '<script type="text/javascript">alert("Email failed.");</script>';
    }
     
    Last edited: Nov 25, 2015
    hostingv, Nov 25, 2015 IP
    robyries likes this.