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?
 
HyperBPPConnect With a Mentor Commented:
of course, replace $email with your email.

'me@myself.com'
0
 
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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
 
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
 
FDMilwaukeeAuthor Commented:
WOOO HOOO, you're the best!!!
0
 
FDMilwaukeeAuthor Commented:
thanks for the help
0
 
HyperBPPCommented:
Glad I could help,  Happy programming!
0
All Courses

From novice to tech pro — start learning today.