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 8885669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:22:01+00:00 2026-06-14T21:22:01+00:00

When I use the PHPMailer library, my script runs fine from CLI, but when

  • 0

When I use the PHPMailer library, my script runs fine from CLI, but when I run it using cron, multiple emails get sent out. I have a list of addresses to send to, then for every next mail recipient, excluding the first one, it sends duplicates.

Example:

I send a message to 3 mail recipients every ten minutes

1st recipient received same email once.

2nd recipient received same email twice.

3rd recipient received same email three times.

4th recip. four times… etc..

The Code:
http://pastebin.com/XjtgEN8u

The crontab :

0,10,20,30,40,50 * * * * /etc/webmin/cluster-cron/cron.pl 1353486136-28420
  • 1 1 Answer
  • 0 Views
  • 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-06-14T21:22:02+00:00Added an answer on June 14, 2026 at 9:22 pm

    The problem is that you’re not creating a new PHPMailer object for each email you’re sending. The result is that you’re storing all the email addresses already sent to (in previous loops), and resending to them on all subsequent loops. That’s why you get incremental duplication.

    To fix the problem, put this line inside your while loop:

    $mail = new PHPMailer(true);
    

    That will instantiate a new mail object for each email address, and reset your email list to 0 before adding the new one.

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

Sidebar

Related Questions

Well i will use PHPMailer to send a lot of emails via cron. Should
I'm trying to use PHPMAILER, but I keep getting: SMTP -> FROM SERVER:220 smart6.bol.com.br
I'm using phpmailer to send email. But all of my emails are send with
I am trying to use phpmailer to send out a newsletter, but I keep
I am trying to send an email from PHP using PHPmailer() . I have
i m using phpmailer class for sending emails. i m geeting error Could not
Hello I'm trying to use PHPMailer to send emails via SMTP. So, on my
Question is simple: should i use any type of sanitization when using PHPmailer class?
Using PHPMailer to send individual emails to recipients I'm getting nothing in the To:
I tried to use php mailer but errors as follows. SMTP -> FROM SERVER:

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.