Newsletter Mail Problem (SMTP)

I’m having issues with the Newsletter mailing system. I’ve noticed that standard emails about orders or profile updates are sent successfully. Upon looking at the email headers, it’s using PHPMailer to send those.



For whatever reason, SMTP will not send. I’m getting an “Could not connect to SMTP Host” error message. In Settings->Email, I’ve even set it to PHPMailer and removed all SMTP information and I still get that error message.



The kicker is my Outlook account uses the exact same SMTP settings that I put into CS-Cart and I am able to send mail no problem. My SMTP server is on port 26. I’ve tried appending “:26” to the SMTP host and no luck. I’ve also tried changing my addons/news func.php to add new_mailer->Port = ‘26’ and no luck. I’ve also tried adding mailer->Port = ‘26’ to the fn.init.php file and no luck.



Any help would be appreciated



Thanks

Unfortunately cs-cart doesn't support using alternate ports via the admin panel. Hence you need to add a PHP hook and set it yourself.



I use a special port as well and my addons/my_changes/init.php has:

fn_register_hooks('send_mail_pre');



and my addons/my_changes/func.php has a:

function fn_my_changes_send_mail_pre(&$mailer) {

$mailer->SMTP_PORT = XX; // XX is your port number

}

Tony. Thanks for the quick response as always. Can you just clarify a few things. I’ve had CS-Cart way too long and not taken advantage of hooks :(



the init.php file that we put into addons/my_changes/ simply has that one fn_register_hooks line in it along with the PHP open and close tags?



And addons/my_changes/func.php is simply that one function and nothing else?

if the files do not exist on your current site then they should be created with open and closing PHP tags as well as a line at the top (for security reason) of:


if( !defined('AREA') ) die("Access denied");


And if you're using V4, AREA would be replaced with BOOTSTRAP.



if you currently have an init.php with a current register_hooks() function call then it would be modified like:


// existing register_hooks
fn_register_hooks('get_product_data');
// change to be
fn_registar_hooks('get_product_data', 'send_mail_pre');


Note that if you previously had a fn_register_hooks() function call then you would have a matching function in func.php.



My original example was for sites that do not make use of other PHP hooks and would effectively be starting from scratch. Sites with existing hooks should simply have the developer that did the existing hook(s) add the new hook and hook function.



Hope I didn't confuse you more.