How to send campaigns to all email addresses of a contact/account

I have several contacts and accounts that, for various reasons, have many email addresses each.

For example: Contact 1 has 4 valid email addresses; Contact 5 has 3 valid email addresses; …; Contact 2897 has 4 valid email addresses; etc …

When I send a campaign, if Contacts 1, 5 and 2897 are in the target list, only the primary email address will receive an email while the other addresses are ignored.
This is a big issue for me because some contacts want to be reached to all their addresses (or even better a selection of their email addresses).

The same thing applies also to Accounts.
To achieve this I know that I have to modify some code. I have identified the script: modules/Campaigns/EmailMan.php
I tried commenting out the following lines of code without success:

    //check to see if bean has a primary email address
    if (!$this->is_primary_email_address($module)) {
        //no primary email address designated, do not send out email, create campaign log
        //of type send error to denote that this user was not emailed
        $this->set_as_sent($module->email1, true,null,null,'send error');
        //create fatal logging for easy review of cause.
        $GLOBALS['log']->fatal('Email Address provided is not Primary Address for email with id ' . $module->email1 . "' Emailman id=$this->id");
        return true;
    }

I also tried to create a different query to fetch the email addresses and tried to send the email to each but I have not suceeded in doing it yet.

Any suggestions?

I think this is by design. The most normal situation is for people to prefer not getting spammed on more than one address, although I do see that in some cases you might deem it adequate.

That code you posted is when sending the email in the Queue. You might prefer tweaking the code at the moment when it’s putting the emails in the Queue:

modules/Campaigns/QueueCampaign.php