SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 37
  1. #1
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    project : NewsLetter

    HI all,
    Ive seen many of these on websites and i think they are a excellent way of comunicating with your public, there's just a few areas im not to sure about.

    1: create a simple form to add an email address and name
    2: insert the users details into a table
    3: to send an email pull all the users emails from the data base
    4: have a text area to write your email and a send button

    ok.. I have no problem writing to and extracting data from a table, the only area I think i will have a few problems with is actually conecting the email list to the email i write and send !

    I will try and build the parts I know of and hopefully the community will help me work around the parts I have difficulties with.

    Hope you all could assist me with this

    Best Regards
    Deano

  2. #2
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just an short algorithm for you:
    1. Fill out form (Newsletter title and letter body)
    2. Submit the form to the PHP script that will went out the emails
    3. Retrieve the emails of all subscribers from the database
    4. Iterate through the result set rows and build and send the email to each
    5. Display success message
    6. Exit script or redirect to new page
    What parts do you need help with?
    John

  3. #3
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi John, Ive created the table, input form and the list of all subscribed users


    Subscribe form !
    PHP Code:
    <?php
      
    // includes
    include("conf.php");

      
    // News has been entered
      // using the form below.

      // open database connection
            
    $connection mysql_connect($host$user$pass) or die ("Unable to connect!");
      
    // select database
            
    mysql_select_db($db) or die ("Unable to select database!");
            
    // If news has been submitted,
     // add it to the database.        
      
    if (isset($_POST['submit'])):
      
    $email $_POST['email'];
      
    $name $_POST['name'];
      
    $sql "INSERT INTO kms_nletter SET
              email='
    $email',
              name='
    $name'";
              
      if (@
    mysql_query($sql)) {
      } else {
        echo(
    '<p><font color="red" size="2" face="Arial, Helvetica, sans-serif">there was an Error whilst adding you to the database, please contact the site admin for further details !</font> ' .
             
    mysql_error() . '</p>');
      }

    ?>
    <font color="blue" size="2" face="Arial, Helvetica, sans-serif">Thank you <?php echo $name?> <br>your details have been added successfully to our database !</font>

    <?php
    else: // Allow the user to enter news
    ?>
     
    <blockquote> 
      <p align="center"><font size="3" face="Arial, Helvetica, sans-serif"><strong>NewsLetter 
        Subscription Form<br>
       <br>
       </strong><font size="2">To un-subscribe please use the link provided 
              in the email we send you, and your details will be ereased from our 
              database </font></font></p>
    </blockquote>          
    <blockquote>
            <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
        <p> <font size="2" face="Arial, Helvetica, sans-serif"> Name : <br>
          <input name="name" type="text" id="name" size="30" maxlength="30" STYLE= background="#D3E3F1" />
          <BR>
          Email Address </font>:<br>
          <input name="email" type="text" id="email" size="30" maxlength="30" STYLE= background="#D3E3F1" />
        </p>
            <input type="submit" name="submit" value="Subscribe" STYLE=  background="#D3E3F1" />
            </p>
            </form>
    </blockquote>

    <?php endif; ?>
    Subcribed list
    PHP Code:
    <?php
      
    // includes
    include("conf.php");

    // open database connection
    $connection mysql_connect($host$user$pass$db) or die ("Unable to connect!");

    // select database
            
    mysql_select_db($db) or die ("Unable to select database!");

    $kms_nletter = @mysql_query('SELECT ID, name, email FROM kms_nletter'); 
    if (!
    $kms_nletter) { 
    die(
    '<p><font color="red" size="2" face="Arial, Helvetica, sans-serif">Error retrieving subscribers from the database!</font><br />'
    'Error: ' mysql_error() . '</p>'); 
    }
    echo(
    "<font size='2' face='Arial, Helvetica, sans-serif'><b>Current list of Subscribed Users</b></font><p>
         <table width='558' border='0' cellpadding='0' cellspacing='0'>
         <tr> 
         <td width='234' height='19' valign='top' bgcolor='#333366'><font size='2' color='white' face='Arial, Helvetica, sans-serif'><strong>Name</strong></font></td>
         <td width='324' valign='top' bgcolor='#333366'><font size='2' color='white' face='Arial, Helvetica, sans-serif'><strong>Email Address</strong></font></td>
         </tr>
         </table>
         "
    );
         
    while (
    $name mysql_fetch_array($kms_nletter)) { 
           
    $id $name['ID']; 
           
    $email htmlspecialchars($name['email']);  
           
    $name htmlspecialchars($name['name']); 
      echo(
    "<font size='2' face='Arial, Helvetica, sans-serif'>
            <table width='558' border='0' cellpadding='0' cellspacing='0'>
            <tr> 
            <td width='234' height='19' valign='top'><font size='2' face='Arial, Helvetica, sans-serif'>
    $name</font></td>
            <td width='324' valign='top'><font size='2' face='Arial, Helvetica, sans-serif'>
    $email</font></td>
            </tr>
            </table>
            </font>
            "
    );
    }

    ?>
    and lastly here's the table :

    CREATE TABLE kms_nletter (
    ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    name TEXT,
    email TEXT
    );

    The part i dont understand is.. do i have to pull all the address in a text area ?

    Im a little confused !

  4. #4
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I reformatted your code to make it easier to read.
    I would strongly encourage you to use CSS for your formatting/typesetting. It will make maintenance much easier!

    PHP Code:
    <?php 
      
    // includes 
      
    include("conf.php" ); 
      
    // News has been entered 
      // using the form below. 
      // open database connection 
      
    $connection mysql_connect($host$user$pass) or die ("Unable to connect!" ); 
      
    // select database 
      
    mysql_select_db($db) or die ("Unable to select database!" ); 
             
      
    // If news has been submitted, 
      // add it to the database.         
      
    if (isset($_POST['submit'])): 
        
    $email  $_POST['email']; 
        
    $name   $_POST['name']; 
        
    $sql    "INSERT INTO kms_nletter
                   SET 
                    email='
    $email', 
                    name='
    $name'"
               
        if (@
    mysql_query($sql))
        { 
        }
        else
        { 
          echo 
    '<p>
                  <font color="red" size="2" face="Arial, Helvetica, sans-serif">
                    there was an Error whilst adding you to the database, please contact the site admin for further details !
                  </font>
                  ' 
    mysql_error() . '
                </p>'

        }
    ?> 
      
        <font color="blue" size="2" face="Arial, Helvetica, sans-serif">
          Thank you <?php echo $name?><br />
          your details have been added successfully to our database!
        </font> 
      
    <?php 
      
    else: // Allow the user to enter news 
    ?> 
      
      <blockquote> 
        <p align="center">
          <font size="3" face="Arial, Helvetica, sans-serif">
            <strong>
              NewsLetter Subscription Form<br /><br /> 
            </strong>
            <font size="2">
              To un-subscribe please use the link provided in the email we send you, and your details will be ereased from our 
                database
            </font>
          </font>
        </p> 
      </blockquote>           
      
      <blockquote> 
        <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> 
          <p>
            <font size="2" face="Arial, Helvetica, sans-serif">
              Name :<br /> 
              <input name="name" type="text" id="name" size="30" maxlength="30" STYLE= background="#D3E3F1" /> 
              <br />
              Email Address :<br /> 
            </font>
            <input name="email" type="text" id="email" size="30" maxlength="30" STYLE= background="#D3E3F1" /> 
          </p> 
          <input type="submit" name="submit" value="Subscribe" STYLE=  background="#D3E3F1" /> 
          </p> 
        </form> 
      </blockquote> 
    <?php endif; ?>
    PHP Code:
    <?php 
       
    // includes 
      
    include("conf.php" ); 
    // open database connection 
      
    $connection mysql_connect($host$user$pass$db) or die ("Unable to connect!" ); 
    // select database 
       
    mysql_select_db($db) or die ("Unable to select database!" ); 
      
      
    $kms_nletter = @mysql_query('SELECT ID, name, email FROM kms_nletter'); 
      if (!
    $kms_nletter)
      { 
        die(
    '<p>
              <font color="red" size="2" face="Arial, Helvetica, sans-serif">
                Error retrieving subscribers from the database!
              </font><br />
              Error:
              ' 
    mysql_error() . '
            </p>'
    ); 
      }
      echo 
    "<font size='2' face='Arial, Helvetica, sans-serif'>
              <b>
                Current list of Subscribed Users
              </b>
            </font>
            <p> 
              <table width='558' border='0' cellpadding='0' cellspacing='0'> 
                <tr> 
                  <td width='234' height='19' valign='top' bgcolor='#333366'>
                    <font size='2' color='white' face='Arial, Helvetica, sans-serif'>
                      <strong>
                        Name
                      </strong>
                    </font>
                  </td> 
                  <td width='324' valign='top' bgcolor='#333366'>
                    <font size='2' color='white' face='Arial, Helvetica, sans-serif'>
                      <strong>
                        Email Address
                      </strong>
                    </font>
                  </td> 
                </tr> 
              </table> 
              "

           
      while (
    $name mysql_fetch_array($kms_nletter))
      { 
        
    $id     $name['ID']; 
        
    $email  htmlspecialchars($name['email']);   
        
    $name   htmlspecialchars($name['name']); 
        echo 
    "<font size='2' face='Arial, Helvetica, sans-serif'> 
                <table width='558' border='0' cellpadding='0' cellspacing='0'> 
                  <tr> 
                    <td width='234' height='19' valign='top'>
                      <font size='2' face='Arial, Helvetica, sans-serif'>
                        
    $name
                      </font>
                    </td> 
                    <td width='324' valign='top'>
                      <font size='2' face='Arial, Helvetica, sans-serif'>
                        
    $email
                      </font>
                    </td> 
                  </tr>
                </table> 
              </font> 
              "

      } 
    ?>
    Let me see if I understand the first bit of code you posted. This form allows the user to subscribe to your newsletter, right?

    And the second bit simply echos out the complete list of those users who have subscribed, right?

    And you want to be able, now, to send each of these subscribers a newsletter of your making.

    Have I got all that right?
    John

  5. #5
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi John,
    that's right.. now all i need to do is try and send a message to each subscribed user !

    btw I'm purchasing the CSS book by Kevin Yank today so there's another learning curv

    I've created a very basic form but have no idea how to pull them into the 'recipient' part

    PHP Code:
    <form name="form1" method="post" action="">
          <
    blockquote>
          <
    p><font size="2" face="Arial, Helvetica, sans-serif">
          
    Recipient :<br><input name="RECIPIENT" type="text" id="RECIPIENT"  STYLEbackground="#D3E3F1" size="80" ><br>
          
    Subject : <br> <input name="SUBJECT" type="text" id="SUBJECT"   STYLEbackground="#D3E3F1" size="80" ><br>
          
    Message :</font> <br> <textarea name="MESSAGE" cols="60" rows="20" id="MESSAGE"  STYLEbackground="#D3E3F1" ></textarea>
          <
    p>
          <
    input type="submit" name="Submit" value="Send NewsLetter"  STYLEbackground="#D3E3F1">
          </
    blockquote>
          </
    form
    any feedback would be great, thx for helping me out I appreciate this alot
    Thank you.

    Best Regards
    Deano

  6. #6
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <form name="form1" method="post" action="sendLetter.php"
      <
    blockquote
        <
    p>
          <
    font size="2" face="Arial, Helvetica, sans-serif"
            
    Recipient :<br />
              <
    input name="recipient" type="text" id="recipient" style="background-color: #D3E3F1" size="80"><br /> 
            
    Subject :<br />
              <
    input name="subject" type="text" id="subject" style="background-color: #D3E3F1" size="80" ><br /> 
            
    Message :
          </
    font><br />
            <
    textarea name="message" cols="60" rows="20" id="message"  style="background-color: #D3E3F1"></textarea
          </
    p
          <
    p>
            <
    input type="submit" name="Submit" value="Send NewsLetter"  style="background-color: #D3E3F1"
      </
    blockquote
    </
    form
    If you want to send this to ALL of your subscribers, why do you have a "recipient" field in your form? (BTW: keep your variables in lower-case, or a mix unless they are CONSTANTS. It's a programming conventions and it makes reading code easier across the board).

    Alright, you need a script that will retrieve all the email addresses of your subscribers from the database, and then form and send an email to each.

    sendLetter.php
    PHP Code:
    <?php
      
      $recipient 
    = isset($_POST['recipient']) ? $_POST['recipient'] : '';
      
    $subject   = isset($_POST['subject'])   ? $_POST['subject']   : '';
      
    $message   = isset($_POST['message'])   ? $_POST['message']   : '';
      
      
    //  do data retrieval here
      
      
    while( $arrayVariable mysql_fetch_array$resultSetVariable ) )
      {
        
    mail$arrayVariable['fieldNameOfSubscribersEMail'], $subject$message"From: [your name here]<your email address>" );
      }
      
      echo 
    'Done!';
    ?>
    HTH
    John

  7. #7
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good point, there is no need to have a recipient filed how silly of me !

    ok... i now have the subscribed list of all users and have a form to send the emails from, the main concern is how to place the emails to the form

    do i add the data retrieval as a header ? I'm lost sorry !

    If im being a pain please tell me


    thx again !
    Last edited by Deano; May 19, 2003 at 11:21.

  8. #8
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I'm on the right track now ! here's what i have so far !

    PHP Code:
    <?php

    // includes
    include("conf.php");

    // open database connection
    $connection mysql_connect($host$user$pass$db) or die ("Unable to connect!");

    // select database
            
    mysql_select_db($db) or die ("Unable to select database!");

      
    $subject   = isset($_POST['subject'])   ? $_POST['subject']   : '';
      
    $message   = isset($_POST['message'])   ? $_POST['message']   : '';
      
      
    //  do data retrieval here
      
      
    $kms_nletter = @mysql_query('SELECT ID, name,email FROM kms_nletter'); 
    if (!
    $kms_nletter) { 
    die(
    '<p><font color="red" size="2" face="Arial, Helvetica, sans-serif">Error retrieving subscribers from the database!</font><br />'
    'Error: ' mysql_error() . '</p>'); 
    }
      
      while( 
    $email mysql_fetch_array$kms_nletter ) )
      {
        
    mail$email['email'], $subject$message"From: [Admin]<me@home.co.uk>" );
      }
      
      echo 
    ' NewsLetter has been sent successfully to your Subscribed Users !';
    ?>

    <form name="form1" method="post" action="">
      <blockquote>
    <p><font size="2" face="Arial, Helvetica, sans-serif"><br>
          Subject : <br>
          <input name="subject" type="text" id="subject"   STYLE= background="#D3E3F1" size="80" >
          <br>
          Message :</font> <br>
          <textarea name="message" cols="60" rows="20" id="message"  STYLE= background="#D3E3F1" ></textarea>
        <p>
          <input type="submit" name="Submit" value="Send NewsLetter "  STYLE= background="#D3E3F1">
          </blockquote>
          </form>
    is this ok or is this a total mess ?

    Cheers
    Deano

  9. #9
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not a total mess!
    I'm curious as to why you have the form in your script... Will you want to send a new letter right after the first one?
    John

  10. #10
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi John !!

    It works superb, thx for all your help. Just afew questions I would like to ask though !

    1, How many emails can this hold and send ?
    2, Everytime i fill out the form and click on send ! will the NewsLetter be sent to all one by one subscribers. The reason i ask this is becasue i hear people talk about sending emails all at same time and there server crashing ?

    Cheers
    Deano !

  11. #11
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. I don't know of a limit.
    2. It will send them one by one.

    John

  12. #12
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have an Idea !

    It would be a nice feature If i could pull the recipients name out of the table into the email. I have tried various ways but to no avail !

    Can anyone point me in the right direction please, here's the scipt which sends the email :

    PHP Code:
    <?php 

    // includes 
    include("conf.php" ); 

    // open database connection 
    $connection mysql_connect($host$user$pass$db) or die ("Unable to connect!" ); 

    // select database 
            
    mysql_select_db($db) or die ("Unable to select database!" ); 

      
    $subject   = isset($_POST['subject'])   ? $_POST['subject']   : ''
      
    $message   = isset($_POST['message'])   ? $_POST['message']   : ''
       
      
    //  do data retrieval here 
       
      
    $kms_nletter = @mysql_query('SELECT ID, name,email FROM kms_nletter'); 
    if (!
    $kms_nletter) { 
    die(
    '<p><font color="red" size="2" face="Arial, Helvetica, sans-serif">Error retrieving subscribers from the database!</font><br />'
    'Error: ' mysql_error() . '</p>'); 

       
      while( 
    $email mysql_fetch_array$kms_nletter ) ) 
      { 
       
    "Hi $name\n,";
       
    "To unsubscribe from our NewsLetter click <a href='.php'here</a>";
      
        
    mail$email['email'], $subject$message"From: Admin <me@home.co.uk>" ); 
      } 
       
      echo 
    ' <font color="blue" size="2" face="Arial, Helvetica, sans-serif">NewsLetter has been sent successfully to your Subscribed Users !</font><p><font size="2" face="Arial, Helvetica, sans-serif">You will be redirected to your <b>Subscribed Users Page</b> in 5 seconds</font>'
    ?>

    Best Regards
    Deano

  13. #13
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [img]images/smilies/FRlol.gif[/img] You've got to add these lines to the $message!

    $message = "Hi ".$email['name'].",\nTo unsubscribe from our NewsLetter click <a href=".php"here</a>" . $message;
    Last edited by PHP John; May 19, 2003 at 15:09.
    John

  14. #14
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lo again John, all works well accept that i can't pull the subsribers name and enter it into the email ?

    Any Ideas
    PHP Code:
    <?php 

    // includes 
    include("conf.php" ); 

    // open database connection 
    $connection mysql_connect($host$user$pass$db) or die ("Unable to connect!" ); 

    // select database 
            
    mysql_select_db($db) or die ("Unable to select database!" ); 

      
    $message   = isset($_POST['message'])   ? $_POST['message']   : ''
       
      
    //  do data retrieval here 
       
      
    $kms_nletter = @mysql_query('SELECT ID, name,email FROM kms_nletter'); 
    if (!
    $kms_nletter) { 
    die(
    '<p><font color="red" size="2" face="Arial, Helvetica, sans-serif">Error retrieving subscribers from the database!</font><br />'
    'Error: ' mysql_error() . '</p>'); 

       
      while( 
    $email mysql_fetch_array$kms_nletter ) ) 
      { 
       
    $message "Hi $name,\n\n$message \n\n\nTo unsubscribe from our NewsLetter click http://www.test.php";
        
    mail$email['email'], $email_subject$message"From: $admin_email); 
      } 
       
      echo 
    ' <font color="blue" size="2" face="Arial, Helvetica, sans-serif">NewsLetter has been sent successfully to your Subscribed Users !</font><p><font size="2" face="Arial, Helvetica, sans-serif">You will be redirected to your <b>Subscribed Users Page</b> in 5 seconds</font>'
    ?>
    Thx Again
    Deano

  15. #15
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    See the edited post above yours.
    John

  16. #16
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thx John,
    Ill give it a try !

    It works perfectly, thx for all your help John I couldn't have managed this project on my own ! I hope i can repay the favour sometime

    Best Regards
    Deano 1

  17. #17
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem!
    John

  18. #18
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have I started something I can't finish ?

    Ive been testing the script out and this is what i have found

    this is what I've got so far :
    PHP Code:
    while( $email mysql_fetch_array$kms_nletter ) ) 
      { 
       
    $message "Hi ".$email['name'].",\n\n"$message."\n\n To unsubscribe from our NewsLetter click the link please send an email to $admin_email";   
        
    mail$email['email'], $email_subject$message"From: $admin_email); 
    What's happening now is, in the email thats recieved by the user its printing to the email of all the subscribed user names

    "Hi ".$email['name'].",
    The $Message works perfectly and then there comes the
    To unsubscribe from our NewsLetter click the link please send an email to $admin_email";
    this is also dupliacted like the subsribers names ?

    Here's the link to the script :
    To Subscribe - http://www.ops-centre.co.uk/KMS/nletter/subscribe.php
    Subsribed Uers - http://www.ops-centre.co.uk/KMS/nletter/subscribed.php

    I think I'm going to cry ALOT

    Anyone have any ideas ?

  19. #19
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very strange...
    Try this:
    PHP Code:
    while( $email mysql_fetch_array$kms_nletter ) ) 
      { 
       
    $message 'Hi '$email['name'] .',\n\n'$message .'\n\n To unsubscribe from our NewsLetter click the link please send an email to '$admin_email;    
        
    mail$email['email'], $email_subject$message"From: $admin_email); 
    John

  20. #20
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no luck I'm afraid John

    Has it something to do with HTML enabled emails ?

    if thats the reason I'm realy in deep poo !

  21. #21
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try "echo $message;" and see what you get.
    John

  22. #22
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    k

  23. #23
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did manage to get the users name and message displayed by using this method :
    PHP Code:
    while( $email mysql_fetch_array$kms_nletter ) ) 
      { 
            
    mail$email['email'], $email_subject$email['name'], $message"From: $admin_email); 
    But their name appeared below the message

  24. #24
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tell me what the "echo $message;" gave you.

    This would be placed AFTER this line:
    $message = 'Hi '. $email['name'] .',\n\n'. $message .'\n\n To unsubscribe from our NewsLetter click the link please send an email to '. $admin_email;
    John

  25. #25
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's still the same John, it duplicates its self by how many users are subscribed

    PHP Code:
    while( $email mysql_fetch_array$kms_nletter ) ) 
      {  
      
    $message 'Hi '$email['name'] .',\n\n'$message .'\n\n To unsubscribe from our NewsLetter click the link please send an email to '$admin_email;
      echo 
    $message;
      
      
    mail$email['email'], $email_subject$message"From: $admin_email); 
     
      } 
      echo 
    ' <font color="blue" size="2" face="Arial, Helvetica, sans-serif">NewsLetter has been sent successfully to your Subscribed Users !</font><p><font size="2" face="Arial, Helvetica, sans-serif">You will be redirected to your <b>Subscribed Users Page</b> in 5 seconds</font>'


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
  •