The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
phpmailer problem - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: phpmailer problem (/showthread.php?tid=843)



phpmailer problem - Jeff - 11-22-2017

1. I have been using the 'Test your email settings' option on v4.3.4 using a gmail account to send to another gmail account using a Siteground host.

When the 'use isSMPT' option is set to Yes, and email debugging has a value of 2, the email message is not sent and an SMPT error is shown on the browser display.

When the 'use isSMPT' option is set to No, the email message is successfully sent and received, and no debugging message is shown on the browser window. However, if view the site by ftp, a php_mail.log file is produced (about 456 bytes in size). For every email message successfully sent the php_mail.log continues to increase in size.

I have checked the https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting site 'SMTP Error: Could not connect to SMTP host.' where they suggest - This is often reported as a PHPMailer problem, but it's almost always down to local DNS failure, firewall blocking (for example as GoDaddy does) or another issue on your local network. Not particularly helpful when the email message is successfully sent and received without an error showing on the browser window, but a php_mail.log file is steadily increasing in size.

I can suppress this error using error_reporting(E_ALL ^E_WARNING);
or I could delete the php_mail.log file automatically each time an email is successfully sent using the PHP unlink() function.

I am not sure if these are sensible solutions. I would rather fix a fault rather than suppress/delete the error message.

Does anyone else have this problem, and has anyone come up with a fix?



2. I also noticed that the 4.3.4 version of Userspice has two phpmailer installations, one in the classes folder called by class.autoloader in init.php and a second called by vendor/autoload.php in helpers.php

Can the phpmailer folder in classes be deleted without causing any problems?


Thanks


phpmailer problem - mudmin - 11-23-2017

I really do think that deleting the log file is a sensible option in this case. Maybe delete it if it's over a certain size? We could look at that for userspice as a whole?

Essentially there has been a war on SPAM for the last 15 years and our inboxes are a lot better off for it, but sending simple system notifications have become a lot more complicated.

I'm thinking the class.autoloader one was an oversight in building 4.3.x and most likely will not be needed but I can't confirm that. I'm guessing it's the same with the old phpmailer folder, but I haven't tried deleting that either. I may try renaming it on my production software and see what happens.



phpmailer problem - Jeff - 11-23-2017

Yes SPAM is a problem I could well do without. Google are making it more difficult to use free Gmail accounts.

They can disable your Gmail account for 24 hours if they detect unusual usage. As little as 100 messages in any 24 hours period could cause your account to be disabled for the next 24 hours.

I find it amusing to 'Google the problem' for fixes - some suggest a settings change is needed - visit the less secure apps settings page of the 'sending Google account' and turn on 'access to less secure apps' - but I have not seen this make any difference.

Alternatives to Gmail might be Mailgun - who offer the first 10,000 messages and 100 validations free every month - has anyone had any experience with Mailgun and the setup required?


I agree, deleting the php_mail.log file is probably the easiest quick bodge - even though I would prefer to fix the problem.

I have added the following code to init.php to automatically delete a large (>5000 bytes) php_mail.log file - just after the line:

require_once $abs_us_root.$us_url_root.'users/helpers/helpers.php';

$php_mail_log_path = realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "php_mail.log";
if (file_exists($php_mail_log_path)){
$php_mail_log_filesize = filesize($php_mail_log_path);
if ($php_mail_log_filesize > 5000){
unlink($php_mail_log_path);
}
}

Thanks