Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5985143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:29:09+00:00 2026-05-22T22:29:09+00:00

just done a little bit of code to send out a newsletter based on

  • 0

just done a little bit of code to send out a newsletter based on a sql table.

first one with 70/80 subscribers went off fine, now when i’ve moved to the second one that has around 250, the body_message of the email is repeated inside the email equally to the number of people on the mailing list, in this case I was sending emails with 250 duplicates of the content inside…

not sure whats wrong with the code, have stripped it down as much as i could and was wondering if someone could talk a look and hopefully point out the issue

    <?php

$i=1;
if (isset($_POST['submit_btn'])) {
connect_newsletter();

$result = mysql_query("SELECT id, mail FROM test") or die('Could not connect. ' . mysql_error());

while ($row = mysql_fetch_array($result)) {

    $email = $row['mail'];
    $nid = $row['id'];

    $ip=$_SERVER['REMOTE_ADDR']; 

    $ref="http://www.domain.co.uk";

    $body_message ='newsletter html code';

    $y_email="noreply@domain.co.uk";
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers4=$y_email;       
    $headers .="Reply-to: $headers4\n";
    $headers .= "From: $headers4\n"; 
    $headers .= "Errors-to: $headers4\n"; 

    $subject="subject";

    mail($email,$subject,$body_message,$headers);


    echo $i." sent to ".$email; 
    echo "<br>";
    $i++;
}
}

?>
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:29:10+00:00Added an answer on May 22, 2026 at 10:29 pm

    Watching your code that is not possibile because in the loop you safely reset the value of $body and $subject

    The problem could be somewhere else. Check your sendmail log

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a little bit new to Actionscript, but I can't figure this one out.
I haven't done work in C/C++ for a little bit and was just wondering
This is not a duplicate post, i just done research but not helping. First,
I am just about done writing my first mergesort program and am running into
This code... #!/bin/bash cond=10; for i in {1..$cond} do echo hello; done ...just drives
I am a bit new to threading (not new to C#, just haven't done
I suppose this is an easy problem to solve, it's just a little bit
I've done a bit of googling round but this particular problem is a little
I've done a little bit of playing around with the new HTML5 tags and
After searching and reading a little bit I came up with the following SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.