Daily Lucky Numbers:
4
9
22
32
41
45

Zhen Mailer version 1.3

Started by Chen Zhen, January 25, 2020, 04:12:25 PM

Previous topic - Next topic

Chen Zhen

SMF 2.0.X branch:
Adds STARTTLS-SMTP compatibility & extra utilities for your SMF outbound email.

SMF 2.1.X branch:
Adds utilities for your SMF outbound email.


Zhen Mailer

Version 1.3


Notations:

PHP Mail Users:

Mail server software such as Postfix have a message size limit setting.
If you have a large database and are using the DB backup option you may need to increase this limit to a rather large number.
The setting is usually in Bytes and is based on the decompressed size of each file.
Even though files are compressed, your email program will decompress them to send the data.
This setting should be available in your Control Panel or you can manually adjust a config file if you have that option available.

Postfix reference example

This version concerns major changes and bug fixes.

Zhen Mailer is no longer restricted to SMTP email usage.
People using regular PHP mail may now take advantage of this utility.
If you operate a VPS or dedicated server and need help installing any of the requirements, please feel free to leave a post in the forum.


Branch differences:
SMF 2.1 offers a bit more flexibility due to its structure and use of more hooks compared to the SMF 2.0 branch.
Multiple emailed attachments from a single post in the SMF 2.1 branch will be sent as one email.
SMTP usage is no longer mandatory for this utility as it now supports regular PHP email.

However for the SMF 2.0 branch, it will send an email for each attachment even if all of them are from a single post.
SMTP-STARTTLS support is added for this branch as it is not normally available in SMF 2.0.X.


Zhen Mailer Admin Setting ~ Admin/User ID To Send DB Dumps
Be careful when adding an additional user email address to the sent database and/or attachment emails.
Ensure that the extra email address is one that should be receiving those emails (ie. an admin)


This installation process will add the following:

-> Database dumps that are forwarded to the webmaster email and/or an additional admin email.
-> Attachment backups to the webmaster email and/or an additional admin email as they are posted
-> STARTTLS-SMTP compatibility for use of 3rd party email providers (not necessary when using a properly configured PHP mail transfer client)
-> Options to encrypt any email attachments as compressed zip archives (requires PHP 7.2+ & ZipArchive)

Compatibility notes:
- PHP version 5.5 with the openssl PHP extension enabled is the minimum requirement for STARTTLS-SMTP compatibility
- ZipArchive extension is required for compression of any attachment backups
- PHP version 7.2+ with the ZipArchive extension is required for any archive encryption
- cURL extension is required for the scheduled database dumps option

This will allow your forum to use SMTP email using gmail, hotmail or yahoo mail.
PHP version 7.2+, ZipArchive & cURL extensions are recommended to make full use of this modification.

Updated CA certificates are required for your forum to communicate with email providers using the STARTTLS SMTP extension.
Example settings for your php.ini file may be:
openssl.cafile = /etc/ssl/cacert.pem
curl.cainfo = /etc/ssl/cacert.pem

You can download the latest cacert.pem file here:
https://curl.haxx.se/ca/cacert.pem

Other Notes:
Although it is not mandatory, a mail user named "members" should be created for BCC bulk emails.
SMTP port 587 is recommended.


Zhen Mailer for Simple Machines Forum
c/o Chen Zhen @ web-develop.ca
@license  http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
@copyright 2022 Chen Zhen

3rd Party Usage:
PHPMailer - PHP email creation and transport class.
@license  http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
@author    Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
@copyright 2012 - 2017 Marcus Bointon

Shuttle-Export c/o 2createStudio
PHP based MySQL dump library
@license  http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
@copyright 2015 - 2017 2createStudio

Distributed under the GNU Lesser General Public License -> https://www.gnu.org/licenses/lgpl.html

CLICK HERE TO DOWNLOAD ZHEN MAILER

weezel

#1
After updating my 2.0.19 forum host to PHP8.0, emails are no longer being sent. Zhen Mailer shows this error when accessing Zhen mailer settings...

implode(): Argument #2 ($array) must be of type ?array, string given

No errors are showing elsewhere.

This is running the latest version 1.3

Had to revert back to PHP 7.4  :'(
Hope it's fixable. Thanks for all your mods. You really are a coding wizard  ;D


Chen Zhen

#2
Can you give the file & line that the error showed in the log?

Nevermind.. I found it right away when testing on PHP 8.
I will release a fix for it shortly & thanks for the report.

Chen Zhen


Version 1.3.2 is now available which includes a fix for what was reported.

weezel

Hi,
Well tried your 1.3.2 version and good and bad news. Good news is that it no longer shows an error.
Bad news is that it is still not sending any mail. This is with the mail type set as the default PHP setting.
Reverted back to PHP 7.4 and mail is then sent OK.
No errors are seen in the Admin logs.
Thanks for the quick response anyway  :)

Chen Zhen

#5
This sounds as though some PHP settings need to be adjusted for PHP 8.0.
Compare your PHP 7 php.ini file to your PHP 8 php.ini file.

Check to see if these variables are set to the same values:
openssl.cafile
curl.cainfo
sendmail_path
error_log

Your PHP error log will likely show whatever error is occurring (not the SMF error log).

If you make changes to that file, you'll need to reset Apache afterward.




More than likely it's the sendmail_path that is not configured correctly.
Make sure you remove the semicolon prior to the setting when you want to use/adjust it because that acts as a comment & is ignored when a line starts with it.

weezel

#6
Hi again,
Well I've checked both PHP configs and they look the same.
For some reason, my php  error log has not updated for 2 yrs, even though error logging is enabled.
Something else to look into at some point  ::)
I have a test SMF forum running 2.12 on the same shared hosting server and that sends mail fine when running PHP8.0 using default PHP mail type, so I don't see how the server config can be at fault.
Guess I'll have to try and get the logging sorted to see what the issue is.
I'll report back if I finally get the mail working.
Many thanks for your time.

Chen Zhen

When using PHP FCGI there will likely be 2 php.ini files.
One is the default which is available when installed but when running multiple PHP versions a secondary php.ini is created.
The secondary is the one that takes affect.
This is shared hosting? Is your only way of accessing the php.ini file via a control panel?

Also set your mail.log path from the php.ini file.
Both the error_log & mail.log file paths should be created plus Apache should have ownership + permissions to use the file(s).

Is it only Zhen Mailer that isn't working?
Does your PHP mail work just using SMF itself?
Admin -> Mail -> Send Test

If it doesn't work at all only with PHP 8.0 then something is awry with a config file native to that PHP version.

Check your admin email for spam and/or all mail.
If the mail headers aren't correct then it will be sent through as spam.