problem z zamianą funkcji e-mail na inną

~miron

No avatar

2006-05-11 18:53

Witam serdecznie jak w temacie wykonałem wszystko zdaje się poprawnie iwedług zamieszczonych informacji na link: http://opensolution.org/Quick.Cart/docs/?id=tips#zastapienie_wysylania_e-maila_przez_funkcje_mail_na_inna

funkcja jednak nie działa pojawia mi się błąd problem z wysłaniaem e-maila i tyle czasami wyskakuje error wskazujący na ostatnią linię w pliku other.php

mój plik wygląda następująco:
if( !function_exists( 'sendEmail' ) ){
/**
* Send e-mail * @return string
* @param array $aForm
* @param string $sFile
* @param string $sTargetMail
*/
function sendEmail( $aForm, $sFile = 'contact_send.tpl', $sTargetEmail = null ){
global $tpl;
extract( $aForm );

if( checkLength( $sTopic, 2 ) === true && checkLength( $sMailContent, 2 ) === true && checkEmail( $sSender ) == true ){

if( !isset( $sTargetEmail ) )
$sTargetEmail = EMAIL;

$sMailContent = changePolishToIso( $sMailContent );
$sTopic = changePolishToIso( $sTopic );

require_once 'Mail.php';

$aData['host'] = 'smtp.interia.pl'; // np. adres smtp Twojego serwera
$aData['port'] = 25;
$aData['auth'] = true;
$aData['username'] = 'mironrex@interia.pl'; // Twoj adres email
$aData['password'] = 'nikcawe1'; // haslo do Twojej skrzynki

$aHead['Subject'] = $sTopic;
$aHead['From'] = $sSender;
$aHead['To'] = $sTargetEmail;

$oMail = Mail::factory( 'smtp', $aData );

if( PEAR::isError( $oMail ) ){
$content = $tpl->tbHtml( $sFile, 'SEND_ALERT' );
}
else{
$mError = $oMail->send( $sTargetEmail, $aHead, $sMailContent );
if( PEAR::isError( $mError ) ){
$content = $tpl->tbHtml( $sFile, 'SEND_ALERT' );
}
else{
$content = $tpl->tbHtml( $sFile, 'SEND_GOOD' );
}
}
}
else
$content = $tpl->tbHtml( $sFile, 'WRONG_WORD' );
return $content;
} // end function
if( !function_exists( 'tPrice' ) ){
/**
* Return price format
* @return float
* @param float $fPrice
*/
function tPrice( $fPrice ){
return sprintf( '%01.2f', $fPrice );
} // end function tPrice
}
if( !function_exists( 'throwLastId' ) ){
/**
* Return last inserted id
* @return int
* @param string $sDb
* @param int $iPosition
*/
function throwLastId( $sDb = null, $iPosition = 0 ){
if( !isset( $sDb ) )
$sDb = DB_PRODUCTS;
return dbThrowLastId( $sDb, $iPosition );
} // end function throwLastId
}
if( !function_exists( 'dbThrowLastId' ) ){
/**
* Return last inserted id from db file
* @return int
* @param string $sDb
* @param int $iPosition
*/
function dbThrowLastId( $sDb, $iPosition ){
return $GLOBALS['oFF']->throwLastId( $sDb, $iPosition );
} // end function dbThrowLastId
}
if( !function_exists( 'checkEmail' ) ){
/**
* Check that e-mail is correct
* @return bool
* @param string $sEmail
*/
function checkEmail( $sEmail ){
return eregi( ''^[a-z0-9_.-]+([_.-][a-z0-9]+)*@([a-z0-9_.-]+([.][a-z]{2,4}))+$'', $sEmail );
} // end function checkEmail
}
if( !function_exists( 'throwStatus' ) ){
/**
* Return status limit
* @return int
*/
function throwStatus( ){
if( isset( $_SESSION['bUserQC'] ) && $_SESSION['bUserQC'] === true )
return 0;
else
return 1;
} // end function throwStatus
}
if( !function_exists( 'throwIconsFromExt' ) ){
/**
* Returns extensions icons
* @return array
*/
function throwIconsFromExt( ){
$aExt['rar'] = 'zip';
$aExt['zip'] = 'zip';
$aExt['bz2'] = 'zip';
$aExt['gz'] = 'zip';
$aExt['fla'] = 'fla';
$aExt['mp3'] = 'media';
$aExt['mpeg'] = 'media';
$aExt['mpe'] = 'media';
$aExt['mov'] = 'media';
$aExt['mid'] = 'media';
$aExt['midi'] = 'media';
$aExt['asf'] = 'media';
$aExt['avi'] = 'media';
$aExt['wav'] = 'media';
$aExt['wma'] = 'media';
$aExt['msg'] = 'msg';
$aExt['eml'] = 'msg';
$aExt['pdf'] = 'pdf';
$aExt['jpg'] = 'pic';
$aExt['jpeg'] = 'pic';
$aExt['jpe'] = 'pic';
$aExt['gif'] = 'pic';
$aExt['bmp'] = 'pic';
$aExt['tif'] = 'pic';
$aExt['tiff'] = 'pic';
$aExt['wmf'] = 'pic';
$aExt['png'] = 'png';
$aExt['chm'] = 'chm';
$aExt['hlp'] = 'chm';
$aExt['psd'] = 'psd';
$aExt['swf'] = 'swf';
$aExt['pps'] = 'pps';
$aExt['ppt'] = 'pps';
$aExt['sys'] = 'sys';
$aExt['dll'] = 'sys';
$aExt['txt'] = 'txt';
$aExt['doc'] = 'txt';
$aExt['rtf'] = 'txt';
$aExt['swx'] = 'txt';
$aExt['odt'] = 'txt';
$aExt['vcf'] = 'vcf';
$aExt['xls'] = 'xls';
$aExt['sxc'] = 'xls';
$aExt['ods'] = 'xls';
$aExt['xml'] = 'xml';
$aExt['tpl'] = 'web';
$aExt['html'] = 'web';
$aExt['htm'] = 'web';
$aExt['com'] = 'exe';
$aExt['bat'] = 'exe';
$aExt['exe'] = 'exe';
return $aExt;
} // end function throwIconsFromExt
}
?>

co jest grane proszę o pomoc pozdrawiam

mironrex

treewood (OpenSolution)

Avatar: treewood

2006-05-11 19:44

miron - mysle, ze nie moze sie polaczyc z serwerem pocztowym. sproboj poczytac na http://pear.php.net o tej bibliotece i ewentualnych problemach

tphz

No avatar

2006-10-29 14:46

W linii:

$aData['username'] = 'mironrex@interia.pl'; // Twoj adres email

jest myląca podpowiedź "//Twój adres email"
ponieważ w nawiasie kwadratowym wyraźnie jest napisane, że ma to być nazwa użytkownika
czyli w tym przypadku ta linia powinna wyglądać:

$aData['username'] = 'mironrex'; // Twoj adres email

Należy również pamiętać, o wielkości liter w nazwiach katalogów Mail i Net

treewood (OpenSolution)

Avatar: treewood

2006-10-30 12:40

tphz - slusznie. dzieki za info

kaziol16

No avatar

2007-04-11 01:18

ja mam podobny problem wsyzstko zrobilem zgodnie z instrukcja, sklep nawet sie nie uruchamia wyskakuje tylko biala strona.moj kod wyglada tak :

<?php
if( !function_exists( 'sendEmail' ) ){
/**
* Send e-mail * @return string
* @param array $aForm
* @param string $sFile
* @param string $sTargetMail
*/
function sendEmail( $aForm, $sFile = 'contact_send.tpl', $sTargetEmail = null ){
global $tpl;
extract( $aForm );

if( checkLength( $sTopic, 2 ) === true && checkLength( $sMailContent, 2 ) === true && checkEmail( $sSender ) == true ){

if( !isset( $sTargetEmail ) )
$sTargetEmail = EMAIL;

$sMailContent = changePolishToIso( $sMailContent );
$sTopic = changePolishToIso( $sTopic );

require_once 'Mail.php';

$aData['host'] = 'poczta.o2.pl'; // np. adres smtp Twojego serwera
$aData['port'] = 25;
$aData['auth'] = true;
$aData['username'] = 'kaziol16'; // Twoj adres email
$aData['password'] = 'moje haslo'; // haslo do Twojej skrzynki

$aHead['Subject'] = $sTopic;
$aHead['From'] = $sSender;
$aHead['To'] = $sTargetEmail;

$oMail = Mail::factory( 'smtp', $aData );

if( PEAR::isError( $oMail ) ){
$content = $tpl->tbHtml( $sFile, 'SEND_ALERT' );
}
else{
$mError = $oMail->send( $sTargetEmail, $aHead, $sMailContent );
if( PEAR::isError( $mError ) ){
$content = $tpl->tbHtml( $sFile, 'SEND_ALERT' );
}
else{
$content = $tpl->tbHtml( $sFile, 'SEND_GOOD' );
}
}
}
else
$content = $tpl->tbHtml( $sFile, 'WRONG_WORD' );
return $content;
} // end function
if( !function_exists( 'tPrice' ) ){
/**
* Return price format
* @return float
* @param float $fPrice
*/
function tPrice( $fPrice ){
return sprintf( '%01.2f', $fPrice );
} // end function tPrice
}
if( !function_exists( 'throwLastId' ) ){
/**
* Return last inserted id
* @return int
* @param string $sDb
* @param int $iPosition
*/
function throwLastId( $sDb = null, $iPosition = 0 ){
if( !isset( $sDb ) )
$sDb = DB_PRODUCTS;
return dbThrowLastId( $sDb, $iPosition );
} // end function throwLastId
}
if( !function_exists( 'dbThrowLastId' ) ){
/**
* Return last inserted id from db file
* @return int
* @param string $sDb
* @param int $iPosition
*/
function dbThrowLastId( $sDb, $iPosition ){
return $GLOBALS['oFF']->throwLastId( $sDb, $iPosition );
} // end function dbThrowLastId
}
if( !function_exists( 'checkEmail' ) ){
/**
* Check that e-mail is correct
* @return bool
* @param string $sEmail
*/
function checkEmail( $sEmail ){
return eregi( ''^[a-z0-9_.-]+([_.-][a-z0-9]+)*@([a-z0-9_.-]+([.][a-z]{2,4}))+$'', $sEmail );
} // end function checkEmail
}
if( !function_exists( 'throwStatus' ) ){
/**
* Return status limit
* @return int
*/
function throwStatus( ){
if( isset( $_SESSION['bUserQC'] ) && $_SESSION['bUserQC'] === true )
return 0;
else
return 1;
} // end function throwStatus
}
if( !function_exists( 'throwIconsFromExt' ) ){
/**
* Returns extensions icons
* @return array
*/
function throwIconsFromExt( ){
$aExt['rar'] = 'zip';
$aExt['zip'] = 'zip';
$aExt['bz2'] = 'zip';
$aExt['gz'] = 'zip';
$aExt['fla'] = 'fla';
$aExt['mp3'] = 'media';
$aExt['mpeg'] = 'media';
$aExt['mpe'] = 'media';
$aExt['mov'] = 'media';
$aExt['mid'] = 'media';
$aExt['midi'] = 'media';
$aExt['asf'] = 'media';
$aExt['avi'] = 'media';
$aExt['wav'] = 'media';
$aExt['wma'] = 'media';
$aExt['msg'] = 'msg';
$aExt['eml'] = 'msg';
$aExt['pdf'] = 'pdf';
$aExt['jpg'] = 'pic';
$aExt['jpeg'] = 'pic';
$aExt['jpe'] = 'pic';
$aExt['gif'] = 'pic';
$aExt['bmp'] = 'pic';
$aExt['tif'] = 'pic';
$aExt['tiff'] = 'pic';
$aExt['wmf'] = 'pic';
$aExt['png'] = 'png';
$aExt['chm'] = 'chm';
$aExt['hlp'] = 'chm';
$aExt['psd'] = 'psd';
$aExt['swf'] = 'swf';
$aExt['pps'] = 'pps';
$aExt['ppt'] = 'pps';
$aExt['sys'] = 'sys';
$aExt['dll'] = 'sys';
$aExt['txt'] = 'txt';
$aExt['doc'] = 'txt';
$aExt['rtf'] = 'txt';
$aExt['swx'] = 'txt';
$aExt['odt'] = 'txt';
$aExt['vcf'] = 'vcf';
$aExt['xls'] = 'xls';
$aExt['sxc'] = 'xls';
$aExt['ods'] = 'xls';
$aExt['xml'] = 'xml';
$aExt['tpl'] = 'web';
$aExt['html'] = 'web';
$aExt['htm'] = 'web';
$aExt['com'] = 'exe';
$aExt['bat'] = 'exe';
$aExt['exe'] = 'exe';
return $aExt;
} // end function throwIconsFromExt
}
?>

o co chodzi?

treewood (OpenSolution)

Avatar: treewood

2007-04-11 09:28

kaziol16 - w takim razie to nie wina podmiany funkcji. Czy wgrales sklep na serwer w trybie BINARNYM ?

kaziol16

No avatar

2007-04-11 11:49

Tak, sklep funkcjonuje dobrze, przestaje dzialas jak podmieniam plik other.php:( Moze to wina zlego umieszczenia plikow w katalogi? ale w sumie wszsytko zrobilem tak jak w instrukcji

treewood (OpenSolution)

Avatar: treewood

2007-04-11 14:03

kaziol16 - na moje oko zamien to:
} // end function
if( !function_exists( 'tPrice' ) ){
na to:
} // end function
}
if( !function_exists( 'tPrice' ) ){

kaziol16

No avatar

2007-04-11 14:25

nie pomoglo dalej otwiera sie pusta strona :(

kaziol16

No avatar

2007-04-11 23:56

zmienilem serwer na piwko.pl teraz bez podmiany pliku other.php przy probie wyslania wyskakuje komunikas "wypelnij poprawnie wszystkie pola" mimo ze wszystkie wypelnione albo wyskakuje komunikat" problem z wyslaniem e-maila". Po podmianie pliku other.php dalej wyswietla sie tylko biala strona i sklep nie dziala POMOCY!!:(((

treewood (OpenSolution)

Avatar: treewood

2007-04-12 08:17

kaziol16 - w takim razie jestem pewien, ze cos zle podmieniles. A jaka wersje QC masz?

kaziol16

No avatar

2007-04-12 12:34

mam wersje 2.1 pl tak wygladaja moje katalogi:

katalog glowny:
http://img216.imageshack.us/my.php?image=glownazh8.jpg

Katalog Mail:
http://img257.imageshack.us/my.php?image=mailxi9.jpg

Katalog Net:
http://img216.imageshack.us/my.php?image=netvk7.jpg

Moze chodzi o ta biblioteke GD nie dziala mi sprawdzenie i nie wiem czy mam :(

treewood (OpenSolution)

Avatar: treewood

2007-04-12 15:04

kaziol16 - jesli wyskakuje problem z wyslanie maila to nie mam na to za bardzo rady. Widocznie albo nie masz obslugi wysylania maili, albo podales zle haslo. Sprawdzilem kod i porownalem z QC v2.1 i powinno dzialac. Musisz skontaktowac sie z adminem serwera by Ci doradzil gdyz moze masz na serwerze jakies blokady.

kaziol16

No avatar

2007-04-12 16:22

dzieki bardzo :)

kaziol16

No avatar

2007-04-14 00:14

a moze znacie jakis darmowy hosting na ktorym dziala usluga meil?

treewood (OpenSolution)

Avatar: treewood

2007-04-14 08:56

kaziol16 - ojej darmowego hostingu dla sklepu internetowego nie polecam. Sklep internetowy to nie zwykla stronka. Zalecam wykupienie chocby taniego hostingu ale dobrego np. http://www.ehost.pl rekomendowany przez nas a jeden z tanszych

kaziol16

No avatar

2007-04-14 12:19

chcialem darmowy poniewaz na razie i tak nie zamierzam niczego sprzedawac. pozdr

Do góry
o nas | kontakt