Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Custom email at checkout. 
 
jsrpool
Jr. Member
 
Total Posts:  5
Joined:  2008-06-23
 

I am trying to send an email to another person other than the customer at checkout. I thought the easiest way to do this would be to splice in a bit of custom php in the success.phtml file. I tried added this at the very end of the file:

<?php mail("mysite.com <orders@mysite.com>""Order Details: Order ID""Flavor:  $giftFlavor\n\nStack Type: $stackType""From: Mysite Back-end<noreply@mysite.com>\r\nX-Mailer: PHP 4.x"); ?>

Whenever I add this file I am directed to the following page instead of success. The code should work as I have tested alone with success.

https://mysite.com/report/?id=1006692955257&s;=default

If this is a php page I don’t understand why this wouldn’t work. How can I go about making this custom php insert work at customer checkout?

 
Magento Community Magento Community
Magento Community
Magento Community
 
alistek
Sr. Member
 
Total Posts:  293
Joined:  2008-04-02
Normal, IL
 

Not sure why that might not work and for future reference, copy the backtrace off of the report but it is throwing an problem.  I would take a look at whatever the Magento method of throwing an e-mail and add it to the controller.

$mailTemplate Mage::getModel('core/email_template');
        
$mailTemplate->addBcc($bcc);

        
$mailTemplate->setDesignConfig(array('area'=>'frontend''store'=>$this->getStoreId()))
            ->
sendTransactional(
                
'sales_email/order/template',
                
'sales_email/order_comment/identity',
                
$this->getCustomerEmail(),
                
$customerName,
                array(
                    
'order'         => $this,
                    
'billing'       => $this->getBillingAddress(),
                    
'payment_html'  => $paymentBlock->toHtml(),
                    
'items_html'    => $itemsBlock->toHtml(),
                )
            );

You can use something like that, it is pulled out of Order.php in Sales/Model.  That should get you started.

-Adam

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top