WIP: Update SMTP code to use wrapper function to resolve issue with postfix MTA and EHLO/HELO exchange
Update & Testing:
As per original posting I took a fork and did some updates and testing on the issue logged above.
My core change was to add smtp.SendMail wrapper SendMailEx (based on golang "net/smtp" code) which takes extra parameter to allow use of FQDN in ELHO/HELO exchange. My commento instance is now working with postfix MTA. This used new configuration item: "COMMENTO_SMTP_HELLO_FQDN" which if set results in new behaviour. I have tested this change and no-longer get postfix MTA failure.
NOTE: I selected to use cut of existing net/smtp code as basis for updates rather than gomail, as gomail project has no maintainer and new forked project (mail) appears to be under a cloud, due dispute on ownership. net/smtp itself is locked, so there is no choice but to use workaround. My SendMapEx still uses net/smtp for the heavy lifting.
In trying to get Core Change completed I had issues with build process and so also did the following:
- A. Split commento go code into two packages" "commento/api" for function code and "main" for commento main executable.
- B. Updated the Makefies to seperate the build targets (build, install, clean, disk etc) from the environments (dev, test, prod) and also decouple front end verbosity (verbose / quiet), from the target environment (dev, test, prod).
- C. To decouple frontend verbosity I add m4 processing step. This was my hack as I am not experienced with gulp but suspect you could achieve this same with this.
My changes have touched a much larger code foot print than I initially anticipated :-( . However I think there is value in these updates so I am adding request to merge with upstream. Once merged I am now familiar enough with code, that I could tackle some other of the logged issues, as backlog is getting rather long ...
As indicated my update ripple through large amount of code. I believe this may impact CI/CD process, hence WIP and this would require further testing. So far I have only tested that issues is resolved.