Paul EC1 Posted July 29, 2008 Share Posted July 29, 2008 Hi all, I have a email function that works well when called, but when i strip the code out of it's original page and past it into different page code it falls on its face...!! and does nothing!!! Any help it very much appreciated to get it to work Regards Paul Here my new page, the one i want to work... ??? $aData = throwOrder( $iOrder ); if( isset( $aData ) && is_array( $aData ) ){ $iStatus = "5"; saveOrderStatus( $iOrder, $iStatus ); //////////////////////////inserted email code if( !function_exists( 'throwOrdersIdTemp' ) ){ require_once DIR_CORE.'orders-'.$config['db_type'].'.php'; require_once DIR_CORE.'orders.php'; require_once DIR_CORE.'couriers-'.$config['db_type'].'.php'; require_once DIR_CORE.'couriers.php'; } $iOrder = $_SESSION['iOrderSession_'.LANGUAGE]; $sTo = $_POST['sEmail']; $sTemplate = $config['language'].'_sendOrderToClient.tpl'; $sTitle = $tpl->tbHtml( $sTemplate, 'EMAIL_TITLE' ); $sEmailContent = listBasket( $iOrder, $sTemplate ); if( !empty( $_POST['iCourier'] ) && !empty( $sEmailContent ) ){ $sEmailContent = $tpl->tbHtml( $sTemplate, 'EMAIL_HEAD' ).$sEmailContent; $aCourier = explode( '|', $_POST['iCourier'] ); $aCourier = throwCourier( $aCourier[0] ); if( function_exists( 'changeCourierPaymentPrice' ) ) changeCourierPaymentPrice( $aCourier, $iOrder ); $fSummary = tPrice( $aCourier['fPrice'] + $aList['fSummary'] ); $sSummary = changePriceFormat( $fSummary ); $sEmailContent .= $tpl->tbHtml( $sTemplate, 'EMAIL_FOOT' ); } @mail( $sTo, $sTitle, ereg_replace( '\|n\|', "\n", $sEmailContent ), 'FROM: '.$config['email']."\r\nContent-Type: text/plain; charset=".$config['charset']."\r\n" ); //////////////////////end of inserted code require DIR_CONFIG.'lang_'.$aData['sLang'].'.php'; $sBasketList = listBasket( $iOrder, 'orders_details.tpl' ); if( !empty( $sBasketList ) ){ $aData['fSummary'] = tPrice( $aData['fCourierPrice'] + $aList['fSummary'] ); $aData['sSummary'] = changePriceFormat( $aData['fSummary'] ); $sBasketList .= $tpl->tbHtml( 'orders_details.tpl', 'COURIER' ); } And the original page of good code if( $p == 'ordersDelivery' && isset( $_SESSION['iOrderSession_'.LANGUAGE] ) && is_numeric( $_SESSION['iOrderSession_'.LANGUAGE] ) ){ if( !function_exists( 'throwOrdersIdTemp' ) ){ require_once DIR_CORE.'orders-'.$config['db_type'].'.php'; require_once DIR_CORE.'orders.php'; require_once DIR_CORE.'couriers-'.$config['db_type'].'.php'; require_once DIR_CORE.'couriers.php'; } if( isset( $_POST['sOption'] ) && $_POST['sOption'] == 'send' && checkOrderFields( $_POST ) ){ $iOrder = $_SESSION['iOrderSession_'.LANGUAGE]; $sTo = $_POST['sEmail']; $sTemplate = $config['language'].'_sendOrderToClient.tpl'; $sTitle = $tpl->tbHtml( $sTemplate, 'EMAIL_TITLE' ); $sEmailContent = listBasket( $iOrder, $sTemplate ); if( !empty( $_POST['iCourier'] ) && !empty( $sEmailContent ) ){ $sEmailContent = $tpl->tbHtml( $sTemplate, 'EMAIL_HEAD' ).$sEmailContent; $aCourier = explode( '|', $_POST['iCourier'] ); $aCourier = throwCourier( $aCourier[0] ); if( function_exists( 'changeCourierPaymentPrice' ) ) changeCourierPaymentPrice( $aCourier, $iOrder ); $fSummary = tPrice( $aCourier['fPrice'] + $aList['fSummary'] ); $sSummary = changePriceFormat( $fSummary ); $sEmailContent .= $tpl->tbHtml( $sTemplate, 'EMAIL_FOOT' ); } $notsure = "test"; @mail( $sTo, $sTitle, ereg_replace( '\|n\|', "\n", $sEmailContent ), 'FROM: '.$config['email']."\r\nContent-Type: text/plain; charset=".$config['charset']."\r\n" ); } } Link to comment https://forums.phpfreaks.com/topic/117258-email-funtion-and-template/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.