CC email address on php email form

I am a novice when it comes to php, and I am trying to figure out how to add an email address to a form processing script.  The script is designed ot take an email address, or multiple email addresses from an input form, and send it to the aforementioned address.  I want to send a CC to a constant email address.  

This script is a "send listing to a friend" script function of an ecommerce platform, and I want to always send a copy to myself.  

See the attached file below.  This is a file from the Magento ecommerce platform

Thanks in advance for your help

FDM
Sendfriend.php
LVL 9
FDMilwaukeeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HyperBPPCommented:
I am not familiar with MAGE, however, have you tried setting the email to a semi-colon delimited list of email address.  It isn't the CC field, but it should be a work-around.

laddy@addy.com;cool@guy.com
0
HyperBPPCommented:
According to http://docs.magentocommerce.com/Mage_Core/Mage_Core_Model_Email_Template.html there is a addBCC($bcc) method that would at least allow you to add a blind carbon copy.
0
FDMilwaukeeAuthor Commented:
Hyper.

I did try adding semi-colon to the email section, however I never got it to work.  I have very little knowledge of PHP, I would be fine with using the semi colon method.

I had not looked at the template file before.  Using that info how would I make it work as shown with the code from their example?

Thanks a lot for your help.  Any suggestion on where a novice such as myself could bone up on some basic PHP?

Thanks again

FDM
public function addBcc($bcc)
    {
        if (is_array($bcc)) {
            foreach ($bcc as $email) {
                $this->getMail()->addBcc($email);
            }
        }
        elseif ($bcc) {
            $this->getMail()->addBcc($bcc);
        }
        return $this;
    }

Open in new window

0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

HyperBPPCommented:
Google is your friend  :)

Insert this on line 76 of your code, it should work.
$this->_emailModel->addBcc($email);
.
.
        $this->_emailModel = Mage::getModel('core/email_template');
        $message = nl2br(htmlspecialchars($this->_sender['message']));
        $sender  = array(
            'name' => strip_tags($this->_sender['name']),
            'email' => strip_tags($this->_sender['email'])
            );
		$this->_emailModel->addBcc($email);
        foreach($this->_emails as $key => $email) {
            $this->_emailModel->setDesignConfig(array('area'=>'frontend', 'store'=>$this->getStoreId()))
            ->sendTransactional(
                Mage::getStoreConfig(self::XML_PATH_SENDFRIEND_EMAIL_TEMPLATE),
                $sender,
                $email,
                $this->_names[$key],
                array(
                    'name'          => $this->_names[$key],
                    'email'         => $email, 
                    'product_name'  => $this->_product->getName(),
                    'product_url'   => $this->_product->getProductUrl(),
                    'message'       => $message,
                    'sender_name'   => strip_tags($this->_sender['name']),
                    'sender_email'  => strip_tags($this->_sender['email']),
                    'product_image' => Mage::helper('catalog/image')->init($this->_product, 'small_image')->resize(75),
                )
            );
        }
.
.

Open in new window

0
HyperBPPCommented:
of course, replace $email with your email.

'me@myself.com'
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FDMilwaukeeAuthor Commented:
WOOO HOOO, you're the best!!!
0
FDMilwaukeeAuthor Commented:
thanks for the help
0
HyperBPPCommented:
Glad I could help,  Happy programming!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.