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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:36:23+00:00 2026-06-16T15:36:23+00:00

I have a form that send multiple emails at once separate them with a

  • 0

I have a form that send multiple emails at once separate them with a colon using zend framework.

Is there a way to prevent sending emails that already exists in database and send those that doesn’t exists?

here’s some here:

html —–

<form method="post" action="<?php echo $this->url(array(), 'inviteByEmail'); ?>">
            <table><tr>
                <td>Email Addresses:* <span class="right small_font" style="margin-right:25px;">* Each email address must be separated by a comma ( , )</span></td>
                <td></td>
            </tr><tr>
                <td><input class="input_long" type="text" name="emails" /></td>
            </tr><tr>
                <td><br/>Personalize your message:</td>
            </tr><tr>
                <td><textarea cols="49" rows="7" name="personal_message"  id="share-text" style="margin-bottom:8px;" placeholder="Download Ad-Aware and help me get PRO version" ></textarea></td>
            </tr><tr>
                <td rowspan="3" valign="top">
                    <input type="submit" class="btn_submit_step3" id="btn_friends" value="share_friends" /><br/>
                </td>
            </tr></table>
        </form>

controller action —–

public function inviteByEmailAction()
{
    $emails = $this->getRequest()->getParam('emails');
    $personal_message = $this->getRequest()->getParam('personal_message');

    $emails = explode(",", $emails);

    foreach ($emails as $email)
    {
        $email = trim($email);
        $validator = new Zend_Validate_EmailAddress();
        if ($validator->isValid($email)) 
        {
            if ($this->_helper->model('EmailInvites')->noRowByFields(array('email' => $email, 'referred_by_user_id' => $this->_helper->user()->id)))
            {
                $email_invite = $this->_helper->model('EmailInvites')->createRow();  
                $email_invite->email = $email;
                $email_invite->personal_message = $personal_message;
                $email_invite->referred_by_user_id = $this->_helper->user()->id;
                $email_invite->save();

                $this->_helper->user()->sendInviteEmail($email, $personal_message);
            }
        }
    }
    $this->getHelper('redirector')->gotoRoute(array(), 'invite');

}

And model has a function to send email.

  • 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-16T15:36:24+00:00Added an answer on June 16, 2026 at 3:36 pm

    You should filter your emails prior to trying to send them. Look into array_diff.

    Here is psedo function to get the job done:

    /**
     * 
     * @param array $userEnteredEmails array with all user entered emails
     * @return array
     */
    protected function _getEmailsThatAreNotInDb(array $userEnteredEmails)
    {
        $db = null; //  your database object
        /* @var $db Zend_Db_Adapter_Abstract */
    
        // get all emails from DB that are in user provided list
        $query = $db->select()
                ->from('emails_table', array('email_address'))
                ->where('email_address IN (?)', $userEnteredEmails);
    
        $emailsInDb = $db->fetchCol($query);
    
        // get emails from user provided list that are not in database loaded list
        $emailNonInDb = array_diff($userEnteredEmails, $emailsInDb);
    
        return $emailNonInDb;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have one form and i am using PHPMailer to send data from that
I have a form page that posts to another page where multiple fields as
I have a function that send one output i.e. 'OPTIONS' as json using ajax.
I have a form that contains multiple partners that share a pool. The partners
I have a page with multiple forms (2 forms) on that page. There is
I have a form that has multiple entries to the same table, the problem
i have already research on using the mail() to send to multiple recipient's but
I have a form that needs to be submitted to two separate URLs: one
I'm using .submit() method to send data. What I have is a question form
I have a multiple select form that I am now trying to use with

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.