bsmither Posted March 28, 2015 Share Posted March 28, 2015 Please test: In the admin skin template settings.index.php, near line 369: Find: <div><label for="email_smtp_user">{$LANG.settings.smtp_user}</label><span><input name="config[email_smtp_user]" id="email_smtp_user" type="text" class="textbox" value="{$CONFIG.email_smtp_user}" autocomplete="off"></span></div> <div><label for="email_smtp_password">{$LANG.settings.smtp_pass}</label><span><input name="config[email_smtp_password]" id="email_smtp_password" type="password" class="textbox" value="{$CONFIG.email_smtp_password}" autocomplete="off"></span></div> Add after: <div><label for="smtp_test_url"><span style="color:red;font-weight:bold;">Save First, then</span> Launch Email Test</label><span> <button type="button" id="smtp_test_url" onclick="$.colorbox({ href:'{$STORE_URL}/{$SKIN_VARS.admin_file}?_g=xml&type=email&q={$CONFIG.email_smtp_password}&function=test' })">Test</button> </span></div> In admin, Manage Hooks, Code Snippets tab, Add Snippet: Enabled: Checked Unique ID: test_email@cubecart (<== max 32 chars) Execution Order: 1 Description: After saving email settings, makes a test email. Trigger: class.ajax.load Version: 1.0 Author: https://forums.cubecart.com/topic/49495-testing-the-stores-email-settings/ PHP Code: <?php if (CC_IN_ADMIN && isset($_GET['type']) && $_GET['type'] == 'email' && isset($_GET['function']) && $_GET['function'] == 'test') { $pass = ($_GET['q']) ? $_GET['q'] : ''; @ob_start(); $test_mailer = Mailer::getInstance(); $test_mailer->SMTPDebug = 2; $test_mailer->Debugoutput = "html"; $test_mailer->ClearAddresses(); $test_mailer->Password = $pass; $test_mailer->AddAddress($GLOBALS['config']->get('config', 'email_address')); $test_mailer->Subject = "Testing CubeCart"; $test_mailer->Body = "Testing from CubeCart v".CC_VERSION." at ".CC_STORE_URL; $test_mailer->AltBody = "Testing from CubeCart v".CC_VERSION." at ".CC_STORE_URL; // Send email $email_test_send_result = $test_mailer->Send(); $email_test_results = @ob_get_contents();@ob_end_clean(); if(!empty($email_test_results)) { $email_test_results_data = array ( 'request_url' => 'mailto:'.$GLOBALS['config']->get('config', 'email_address'), 'request' => 'Subject: Testing CubeCart', 'result' => $email_test_results, 'error' => ($email_test_send_result) ? null : "Mailer Failed" , ); $GLOBALS['db']->insert('CubeCart_request_log', $email_test_results_data); $json = $email_test_results; } else { $json = "Test failed to execute."; } } This will give you the dialog the Mailer has with whatever you have set as the means and server to accept emails from your store. A copy of the dialog is saved in admin, Request Log. The above needs testing! My development environment is not the same as a production environment. Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 29, 2015 Author Share Posted March 29, 2015 If the password has punctuation and other non-letter/number characters, then it may corrupt the data sent to CubeCart for testing. So, make this change in the template: From: {$CONFIG.email_smtp_password} To: {$CONFIG.email_smtp_password|base64_encode} In the snippet: From: $pass = ($_GET['q']) ? $_GET['q'] : ''; To: $pass = ($_GET['q']) ? base64_decode($_GET['q']) : ''; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.