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

  • Home
  • SEARCH
  • 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 226873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:33:05+00:00 2026-05-11T19:33:05+00:00

Why am I receiving same attachment twice with this code!? $mailer = new Zend_Mail(‘UTF-8’);

  • 0

Why am I receiving same attachment twice with this code!?

 $mailer = new Zend_Mail('UTF-8');
 $mailer->setFrom($group_email,$group_name);
 $mailer->setSubject($title);
 $mailer->setBodyHtml($full);

 $fileContents = file_get_contents('test.jpg');
 $attachment = $mailer->createAttachment($fileContents);
 $attachment->filename = "test.jpg";
 $mailer->addAttachment($attachment);

        //get all subscribers
        $i=0;
        foreach ($subscribers->getGroupUsers($group_id) as $sub){
            if ($i==0){
                $mailer->addTo($sub->email);
            }
            else {
                $mailer->addBcc($sub->email);
            }
            $i++;
        }

 $mailer->send(); 
  • 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-05-11T19:33:06+00:00Added an answer on May 11, 2026 at 7:33 pm

    Well problem actuality is in this line

    $mailer->addAttachment($attachment);
    

    Without it, it will work. I didn’t know that because it seems logical to call addAttachment method to me 😛

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

Sidebar

Related Questions

Receiving this error: a different object with the same identifier value was already associated
I am currently receiving this error: Validation of viewstate MAC failed. If this application
This post started as a question on ServerFault ( https://serverfault.com/questions/131156/user-receiving-partial-downloads ) but I determined
We're having the same setup and receiving the same problem as: IIS 6 with
I have been receiving errors when trying to save and run this Python 3.1
I am using the same UDP socket for sending and receiving data. I am
I'm receiving a date from a data source which is returned to javascript code.
I've been receiving this warning since I loaded my project in last Xcode 4
I'm using code examples from this article by Rick Strahl: http://www.west-wind.com/weblog/posts/324917.aspx to make async
This is the description of AppWidgetHost.startListening() : Start receiving onAppWidgetChanged calls for your AppWidgets

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.