Results 1 to 5 of 5

Thread: help me with my script

  1. #1
    Join Date
    Jun 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help me with my script

    hi.. how are you all ?

    i programmed mail script and it's working , but i have some problem

    here is the source

    PHP Code:
    <?php

    /**
     * @author : wlt-php
     * @copyright: 2012
     */

    //mail(to ,title, msg, headers);


    $EmaiL $_POST['youremail'];
    $title $_POST['title'];
    $impor $_POST['impor'];
    $tmsg $_POST['textmsg'];
        if(isset(
    $_POST['do']) && $_POST['do'] == 'send'){
        
        if(empty(
    $EmaiL)){
     echo 
    "Please type E-mail";    
     }elseif(empty(
    $tmsg)){
        echo 
    "Type Your Message ..!";
     }else{
    $to =  "exampl@gmail.com";
    $sub $title;
    $msg $tmsg;
    $headers ="MIMI-Version: 1.0 \r\n";
    $headers .="From: $E-MaiL $title \r\n";
    $headers .="Content-Type: text/html; charset=utf-8 \r\n";
    $headers .="X-priority: 3 \r\n";
    mail($to ,$title$msg$headers); 
        die(
    "Message Sent");
     }
    }

    ?>
    <form action="sendmail.php" method="POST" >
    <table width="60" border="4" align="center">
     <tr>
        <td>E-mail</td>
        <td><input type="text" name="youremail" size="40" /></td>
     </tr>
    <tr>
        <td>Subject</td>
        <td><input type="text" name="title" size="40" /></td>
        
    </tr>
     <tr>
        <td>Message Box</td>
        <td><textarea name="textmsg" rows="20" cols="30"></textarea></td>
     </tr>
    <tr>
        <td></td>
        <td><input type="submit" value="Send" /></td>
    </tr>
    </table>
    <input type="hidden" name="do" value="send" />
    </form>

    the problem:

    1- if i want to send E-mail first i have to modify the script and change the email to the one whom i want to send ($to = "exampl@gmail.com"

    how to make it sending e-mail without editing the code ? means i want to use it directly

    and second thing .. i want to make it send many emails at once

    can someone help me please and correct it

    thank you

  2. #2
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    You can write it so that the user separates the emails by a comma (e.g., "you@yourdomain.com, me@mydomain.com, joe@doe.com" would send to all three of those addresses).

    Accept the string, split it using a comma as a delimiter and write a loop to iterate through each email.

    PHP Code:
    <?php 

    /** 
     * @author : wlt-php 
     * @copyright: 2012 
     */ 

    //mail(to ,title, msg, headers); 


    $emails explode(","$_POST['youremail']); 
    $title $_POST['title']; 
    $impor $_POST['impor']; 
    $tmsg $_POST['textmsg']; 
        if(isset(
    $_POST['do']) && $_POST['do'] == 'send'){ 
         
        if(
    count($emails) == 0){ 
     echo 
    "Please type E-mail";     
     }elseif(empty(
    $tmsg)){ 
        echo 
    "Type Your Message ..!"
     }else{ 
    $sub $title
    $msg $tmsg
    $headers ="MIMI-Version: 1.0 \r\n"
    $headers .="From: $E-MaiL $title \r\n"
    $headers .="Content-Type: text/html; charset=utf-8 \r\n"
    $headers .="X-priority: 3 \r\n"

    foreach(
    $emails as $e) {
        
    $e str_replace(" """$e);
        
    mail($e ,$title$msg$headers);  
    }
        die(
    "Message Sent"); 
     } 


    ?> 
    <form action="sendmail.php" method="POST" > 
    <table width="60" border="4" align="center"> 
     <tr> 
        <td>E-mail</td> 
        <td><input type="text" name="youremail" size="40" /></td> 
     </tr> 
    <tr> 
        <td>Subject (separate by comma)</td> 
        <td><input type="text" name="title" size="40" /></td> 
         
    </tr> 
     <tr> 
        <td>Message Box</td> 
        <td><textarea name="textmsg" rows="20" cols="30"></textarea></td> 
     </tr> 
    <tr> 
        <td></td> 
        <td><input type="submit" value="Send" /></td> 
    </tr> 
    </table> 
    <input type="hidden" name="do" value="send" /> 
    </form>
    - Josh

  3. #3
    Join Date
    Jun 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    very good .. thanks alot

    but still second pro it's not solved

    what i mean is .. there should be E-mail box for the mail list ..
    suppose i have 1000 email of members want to send them message at once

    and also number of time , like if i want to send same message twice at once

    how to do that please

    thank you again

  4. #4
    Join Date
    Aug 2011
    Location
    Rep Of Ireland
    Posts
    126
    Thanks
    24
    Thanked 3 Times in 1 Post

    Default

    This will help you build a Mail List Manager. Visitors can submit
    their emails
    to your list and get an auto responder message in
    return. The list/lists will enable you to send bulk messages from
    time to time.

    http://www.devshed.com/c/a/PHP/Creat...ager-with-PHP/

  5. #5
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    Quote Originally Posted by wtl-php View Post

    what i mean is .. there should be E-mail box for the mail list ..
    suppose i have 1000 email of members want to send them message at once
    Be more specific. What do you mean by 'E-mail box'? The form field for email is the one where you would enter the 1000 email addresses.

    Quote Originally Posted by wtl-php View Post

    and also number of time , like if i want to send same message twice at once
    The modified script I made sends the email to all of the emails specified in the emails form field.
    - Josh

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •