plugin smtp mail

cachousam

Avatar: cachousam

2013-05-10 09:57

hello,
I changed the SMTP plugin for qc3.7 like this.

But emails are not sent.
Thank you for your help

function sendEmail( $aForm, $sFile = 'messages.tpl', $sTargetEmail = null ){
extract( $aForm );
$oTpl =& TplParser::getInstance( );

if( !empty( $sTopic ) && !empty( $sMailContent ) && checkEmail( $sSender ) === true ){
$sMailContent = change2Latin( $sMailContent );
$sTopic = change2Latin( $sTopic );

if( !empty( $sPhone ) )
$sMailContent = $GLOBALS['lang']['Phone'].': '.change2Latin( $sPhone )."\n".$sMailContent;
if( !empty( $sName ) )
$sMailContent = $GLOBALS['lang']['Name_and_surname'].': '.change2Latin( $sName )."\n".$sMailContent;

if( !isset( $sTargetEmail ) )
$sTargetEmail = $GLOBALS['config']['email'];

require_once DIR_PLUGINS.'pear/Mail.php';

$aData['host'] = 'xxx.gmail.com '; // set here smtp address
$aData['port'] = 465; // write port here, default is 25
$aData['auth'] = true; // usually need to be set true
//$aData['secure'] = 'ssl';
//$aData['starttls'] = true;
$aData['username'] = 'xxxxx@gmail.com'; // user name or email address
$aData['password'] = 'xxxx'; // password to your email account

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

if( PEAR::isError( $oMail ) ){

if( isset( $sFile ) )
return $oTpl->tbHtml( $sFile, 'MAIL_SEND_ERROR' );
else
return false;
}
else{
$mError = $oMail->send( $sTargetEmail, Array( 'Subject' => '=?UTF-8?B?'.base64_encode( $sTopic ).'?=', 'From' => $sTargetEmail, 'To' => $sTargetEmail, 'Reply-to' => $sSender, 'Content-Type' => 'text/plain; charset=UTF-8', 'MIME-Version' => '1.0' ), $sMailContent );
if( PEAR::isError( $mError ) ){
if( isset( $sFile ) )
return $oTpl->tbHtml( $sFile, 'MAIL_SEND_ERROR' );
else
return false;
}
else{
if( isset( $sFile ) )
return $oTpl->tbHtml( $sFile, 'MAIL_SEND_CORRECT' );
else
return true;
}
}
}
else{
if( isset( $sFile ) )
return $oTpl->tbHtml( $sFile, 'REQUIRED_FIELDS' );







function sendEmail( $aForm, $sFile = 'messages.tpl', $sTargetEmail = null ){
extract( $aForm );
$oTpl =& TplParser::getInstance( );

if( !empty( $sTopic ) && !empty( $sMailContent ) && checkEmail( $sSender ) === true ){
$sMailContent = change2Latin( $sMailContent );
$sTopic = change2Latin( $sTopic );

if( !empty( $sPhone ) )
$sMailContent = $GLOBALS['lang']['Phone'].': '.change2Latin( $sPhone )."\n".$sMailContent;
if( !empty( $sName ) )
$sMailContent = $GLOBALS['lang']['Name_and_surname'].': '.change2Latin( $sName )."\n".$sMailContent;

if( !isset( $sTargetEmail ) )
$sTargetEmail = $GLOBALS['config']['email'];

require_once DIR_PLUGINS.'pear/Mail.php';

$aData['host'] = 'xxx.gmail.com '; // set here smtp address
$aData['port'] = 465; // write port here, default is 25
$aData['auth'] = true; // usually need to be set true
//$aData['secure'] = 'ssl';
//$aData['starttls'] = true;
$aData['username'] = 'xxxxx@gmail.com'; // user name or email address
$aData['password'] = 'xxxx'; // password to your email account

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

if( PEAR::isError( $oMail ) ){

if( isset( $sFile ) )
return $oTpl->tbHtml( $sFile, 'MAIL_SEND_ERROR' );
else
return false;
}
else{
$mError = $oMail->send( $sTargetEmail, Array( 'Subject' => '=?UTF-8?B?'.base64_encode( $sTopic ).'?=', 'From' => $sTargetEmail, 'To' => $sTargetEmail, 'Reply-to' => $sSender, 'Content-Type' => 'text/plain; charset=UTF-8', 'MIME-Version' => '1.0' ), $sMailContent );
if( PEAR::isError( $mError ) ){
if( isset( $sFile ) )
return $oTpl->tbHtml( $sFile, 'MAIL_SEND_ERROR' );
else
return false;
}
else{
if( isset( $sFile ) )
return $oTpl->tbHtml( $sFile, 'MAIL_SEND_CORRECT' );
else
return true;
}
}
}
else{
if( isset( $sFile ) )
return $oTpl->tbHtml( $sFile, 'REQUIRED_FIELDS' );

» Quick.Cart v3.x

maplewang

Avatar: maplewang

2017-04-20 04:56

Is it possible be used in V6.7 free version? where is the plugin? thanks

Roni

Avatar: Roni

2017-04-21 09:38

If cachousam broke something there (in working plugin) it will not work in 6.7 also.
I think phpmailer library will be better choice to send emails if simple email function will not be enough for you.
If you can't integrate it by yourself ask someone to do that for you.

Back to top
about us | contact