Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions
You are not logged in.
I have tested SMTP settings using gmail and receive the LHC Test mail. SMTP settings are correct.
I have created new accounts both manually and through the automated hosting API and neither send out the email. I have used different email addresses in the new account.
I turned on phpmail error log, but nothing is logged there. I can't find any other error log to check for email.
What settings affect email?
Is there any logging from LHC that can be turned on?
Offline
Hi,
No, there is no log stuff. Just cronjob does the all stuff, sends mail etc. You can just create instance from back office and try to run cronjob and debug the following function
https://github.com/LiveHelperChat/autom … ce.php#L88
While testing you can try to leave just php mailer in this function, that way you will see what is happening. Etc...
Offline
Is it difficult to implement the logging class with something like: erLhcoreClassLog::write('New customer email - preparing'))
Offline
Hi,
Nop, you can do that also at the moment with.
erLhcoreClassLog::write(print_r($_POST,true)); // Example
And you will find log file in cache/ folder.
Offline
when I manually run "/usr/bin/php cron.php -s site_admin -e instance -c cron/maintain > cron_lhc.log" from the lhc_web folder the cron_lhc.log is empty.
edit: but the instances are being created with no problem.
Last edited by devman (2014-10-31 19:03:29)
Offline
Sorry, but the only option for you is just echo | exit. No other way to see what's failing at your part...
Offline
So after much debugging this is what I found:
When a new instance is created it copies some settings from somewhere and puts them in the new database (copying a database?). I may not have set up SMTP before installing Automated Hosting so every new instance does not have SMTP settings enabled. I have created over 60 instances but am on a dev server.
I did not see anything in the Automated Hosting install instructions about having STMP preconfigured being a requirement. I can update the docs once I understand how this works, if you like.
Questions:
1. When a new instance is created where does it pull its initial configuration and data that goes into the new database from? I tried going through the code but did not understand if it was copying a database or pulling settings from cache.
2. What can I change in my configuration so the next instance that gets created has SMTP enabled?
3. Should a change be considered where the first welcome email sent is based on the main manager settings rather than an instance?
If the instance settings are pulled from the main database and that is set up with something like gmail, the gmail address of the original person will be in carried over to the instance. I don't think that is appropriate. Should each instance be able to set their own SMTP or should there be a global service?
On another note the logging worked except every time it creates a log entry it copies it then number of times it has logged one. Makes the log grow fast. How can this be stopped?
[== Undefined ==]
Oct 31 17:29:02 [Warning] [default] [default] New customer email - preparing
Oct 31 17:29:02 [Warning] [default] [default] New customer email - new phpmailer
Oct 31 17:29:02 [Warning] [default] [default] New customer email - new phpmailer
Oct 31 17:29:02 [Warning] [default] [default] New customer email - setting up SMTP to:***.com
Oct 31 17:29:02 [Warning] [default] [default] New customer email - setting up SMTP to:***.com
Oct 31 17:29:02 [Warning] [default] [default] New customer email - setting up SMTP to:***.com
Oct 31 17:29:02 [Warning] [default] [default] New customer email - sending to:***.com
Oct 31 17:29:02 [Warning] [default] [default] New customer email - sending to:***.com
Oct 31 17:29:02 [Warning] [default] [default] New customer email - sending to:***.com
Oct 31 17:29:02 [Warning] [default] [default] New customer email - sending to:***.com
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer check addresses
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer check addresses
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer check addresses
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer check addresses
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer check addresses
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer check body
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer check body
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer check body
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer check body
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer check body
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer check body
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer determine mailer:mail
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer determine mailer:mail
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer determine mailer:mail
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer determine mailer:mail
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer determine mailer:mail
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer determine mailer:mail
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer determine mailer:mail
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR on line:606
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR on line:606
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR on line:606
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR on line:606
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR on line:606
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR on line:606
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR on line:606
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR on line:606
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR msg:Could not instantiate mail function.
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR msg:Could not instantiate mail function.
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR msg:Could not instantiate mail function.
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR msg:Could not instantiate mail function.
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR msg:Could not instantiate mail function.
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR msg:Could not instantiate mail function.
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR msg:Could not instantiate mail function.
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR msg:Could not instantiate mail function.
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR msg:Could not instantiate mail function.
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR code:2
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR code:2
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR code:2
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR code:2
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR code:2
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR code:2
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR code:2
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR code:2
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR code:2
Oct 31 17:29:02 [Warning] [default] [default] New customer email - phpmailer ERROR code:2
Offline
It takes default instance settings from
https://github.com/LiveHelperChat/autom … c/db_3.sql
You should just adjust this file according to your needs.
About duplicating log really don't know.
Offline
After reviewing this further, this is not an instance issue, but a server OS mail configuration and default email transport determination issue in LHC.
Background: I have my dev server on a droplet on Digitalocean using a LAMP stack. It turns out that no mail transport is installed by default. I installed and configured sendmail.
Just installing sendmail did not solve the issue.
In the PHPMailer class (lib\core\lhcore\class.phpmailer.php) the default Mailer is "mail".
Each time email is sent a call is made to "setupSMTP" (in lib\core\core\lhchat\lhchatmail.php). This checks the current instance to see if SMTP is enabled. Since a new instance does not have it enabled, SMTP is not used. The system then defaults to "mail" in the phpmailer class and in my case that was not configured so welcome messages did not send.
One potential solution is to modify phpmailer class to make "sendmail" the default (and make sure sendmail is installed), but this does not give the user an option of what email transport to use.
I think a better solution is to create a entry in the settings file for "default_email_transport" and add an "else" in the setupSMTP to check for it. Also the instructions should explain about email transport being set up properly and if automated hosting is installed the server must have a mail transport set up.
Current setupSMTP:
[== PHP ==]
public static function setupSMTP(PHPMailer & $phpMailer)
{
$smtpData = erLhcoreClassModelChatConfig::fetch('smtp_data');
$data = (array)$smtpData->data;
if ( isset($data['use_smtp']) && $data['use_smtp'] == 1 ) {
$phpMailer->IsSMTP();
$phpMailer->Host = $data['host'];
$phpMailer->Port = $data['port'];
if ($data['username'] != '' && $data['password'] != '') {
$phpMailer->Username = $data['username'];
$phpMailer->Password = $data['password'];
$phpMailer->SMTPAuth = true;
}
}
}
Proposed addition of check for default transport:
[== PHP ==]
public static function setupSMTP(PHPMailer & $phpMailer)
{
$smtpData = erLhcoreClassModelChatConfig::fetch('smtp_data');
$data = (array)$smtpData->data;
if ( isset($data['use_smtp']) && $data['use_smtp'] == 1 ) {
$phpMailer->IsSMTP();
$phpMailer->Host = $data['host'];
$phpMailer->Port = $data['port'];
if ($data['username'] != '' && $data['password'] != '') {
$phpMailer->Username = $data['username'];
$phpMailer->Password = $data['password'];
$phpMailer->SMTPAuth = true;
}
}else{
$cfg = erConfigClassLhConfig::getInstance();
$phpMailer-> Mailer = $cfg->getSetting( 'site', 'default_mail_transport' );
}
}
Add an entry in the settings file in the 'site' section:
[== PHP ==]
'default_mail_transport => 'sendmail', //sendmail or mail. If using automated hosting: Each instance can enable SMTP to override default. sendmail or mail must be installed/configured for welcome and system messages.
If you think this is a good approach let me know if you would like me to put a pull request on github.
Offline