Issue with PHP email (fatal error result of deprecated case-insensitive constants) #396
Replies: 23 comments 30 replies
-
|
These classes (smtp.php and htmlMimeMail.php) are external libraries that are now very old and unmaintained. We need to decide whether we want to keep this functionality (ability to email reports directly from within webERP) or just to allow webERP to create files that the user can email themselves. PHP does have it's own functionality to do this, but it needs the work doing. Thanks |
Beta Was this translation helpful? Give feedback.
-
|
Are there any known issues now for WebERP due to these libraries? I.e. is this a "critical" issue to resolve now or a future maintenance task to migrate to the current preferred project for long-term support? Here's the list of email features from the weberp.org features page. Any errors or omissions?
Fwiw, I found only one "email" item in the menu ([Main Menu > Asset Manager > Inquiries and Reports > Maintenance Reminder Emails]). Imho, WebERP needs to be able to email at least system and other regular reports, and I expect automated emailing purchase orders to all the vendors for all the raw material required for a production build could be useful. However, if I was using webERP interactively I wouldn't be bothered if I had to generate a PDF report and then email it in a seperate step. |
Beta Was this translation helpful? Give feedback.
-
|
Existe en Wordpress un plugins y se llama smtp y funciona bien , voy a
mirar y les comparto (spanish)
Gracias ...
El mié, 26 mar 2025 a la(s) 3:19 p.m., Tim Schofield (
***@***.***) escribió:
… Changing the code to use a different library is not too hard. The main
issue as I see it is that the scripts give the impression that the user
just has to click the option and an email will be sent. The reality is that
the user needs access to a properly configured SMTP server. These days that
is a lot harder than it was. Gmail is popular for this purpose, but to try
and curtail spammers this is now a lot harder -
https://mailtrap.io/blog/phpmailer-gmail/
Many many years ago I wrote SMTPServer.php to setup the SMTP server
details, but now it is more complex. That is why I wonder if the time has
come to just remove the code. At the very least I think we should only have
the options available if a working SMTP server details are setup in a
revamped SMTPServer.php
Thanks
Tim
—
Reply to this email directly, view it on GitHub
<#396 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BQ3GNWRBSLDFX634SZKBDOL2WL4SPAVCNFSM6AAAAABZ2WRTYCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTENRTGMZDQMQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Muy atentamente envió a ustedes cotización para orden de compra según
conversación, esperamos tener una excelente relación comercial que permita
servirle a satisfacción
Atte
Sandra E. Herrera Rojas
Gerente de Ventas
JAISANTEX S.A.S
Modas, Diseños, Estilos -
Uniformes y Dotaciones Empresariales . Modas & Diseños exclusivos
Calle 7b No. 62-39 Villa Olímpica
Tels.3226424971 - 3225298328
Galapa - Atlántico
***@***.***
***@***.***
|
Beta Was this translation helpful? Give feedback.
-
|
Creo que el plugin de WordPress necesita que configures los detalles de tu servidor SMTP. Todo esto se puede hacer en webERP, solo es cuestion de si es necesario. - disculpas por mi mal espanol. In English: Tim |
Beta Was this translation helpful? Give feedback.
-
|
Hi: I am currently (last commit) sending emails from webERP without problem, and we use this functionality daily. It saves time and human mistakes compared to downloading a PDF, drafting an email, attaching the PDF, sending. In SystemParameters.php there is this setting: I couldn't setup WAMMP on my local Windows machine to send emails, thought. I am not sure if it is a WAMMP or webERP issue. (Didn't devote much time) @Jainsatex could you check this setting in SystemParameters.php? @timschofield I guess we could better encapsulate the functionality of sending an email, as an example, this code structure is repeated many times, with several variations around webERP. Probably we could benefit from a
Thanks, |
Beta Was this translation helpful? Give feedback.
-
|
Hi all, can anyone describe a couple simple user procedure that can be used for basic email testing? I'm looking for two user procedures: 1) send text-only email, and 2) send text email with PDF attachment. Ideally the procedures would only require having items in the database (my database only has part numbers, with no stock, sales orders or purchase orders). Thanks everyone! :-) |
Beta Was this translation helpful? Give feedback.
-
|
@pakricard: are you just sending emails to users on the local network, or are you sending emails to outside email addresses, eg gmail? Also what version of PHP is running on that server? @dalers "but how to configure WebERP must be the responsibility of the implementer for the SMTP server of their choice." I agree. My concern is that as webERP currently is written, users are given the impression that if they click on the option, then an email is sent. As you say, it needs proper configuration. The consensus seems to be that we do need the facility to email directly from webERP, so we need to look at how that can be done. I think it would make sense to only show the options to email if a correctly configured server is setup. Do we agree? Thanks |
Beta Was this translation helpful? Give feedback.
-
|
This is from the htmlMimeMail project: "PROJECT NO LONGER BEING MAINTAINED |
Beta Was this translation helpful? Give feedback.
-
|
I have played around with PHPMailer and it was fairly painless to send an email from my gmail account with a PHP script. The only real gotcha was that it requires a separate password that is auto generated by Google, and not my normal gmail password. It wasn't immediately obvious how to do that but I got there with a bit of searching. Tentative proposal: We move to using PHPMailer, and store the server settings in the emailsettings table via the SMPTServer.php script all of which currently exists. If no record exists in that table then the option to mail won't even be offerred. The onus on getting the setup right is still on the user. |
Beta Was this translation helpful? Give feedback.
-
@PhilDaintree I don't think it should matter. Many (most?) organizations use managed services (i.e. not the local network), and an organization cable of running their own mail server within their network will likely know how to configure it with appropriate security (hackers are not just outside the walls).
@PhilDaintree This would seem require only wording changes to clarify the behavior. What "options" are you referring to? I'm still looking for a couple simple procedure to use for testing that don't require purchase orders, sales orders or stock quantities......
Agree 150%! :-) PHPMailer seems to be the obvious choice for a PHP app - and not just because of the clue in the name ;-) |
Beta Was this translation helpful? Give feedback.
-
|
Btw, if the email security key is in the database it will end up in database backups, test databases, etc. What would you think of a general policy that all system security keys are ONLY in config.php? (with the database user password) |
Beta Was this translation helpful? Give feedback.
-
Hi @timschofield: Hope it helps, |
Beta Was this translation helpful? Give feedback.
-
|
Este plugins esta en algunas versiones de WordPress, alguien la conoce? /* FluentSMTP is free software; you can redistribute it and/or |
Beta Was this translation helpful? Give feedback.
-
|
On Fri, 28 Mar 2025 at 18:20, Dale Scott ***@***.***> wrote:
with respect ;-) I suggest you might have a selection bias based on the installations you know of, although I don't have any data to prove it.
Of course you're right, but my point is that we cannot make
assumptions while we are developing as to how people are hosting their
webERP.
Tim
|
Beta Was this translation helpful? Give feedback.
-
|
I might also consider migrating in phases to simplify implementation and testing.
I recommend we discuss potential new functionality now, but wait to implement until the current email functionality has been migrated and tested. Discussion of new functionality may also affect how to migrate current functionality. E.g. @timschofield #396 (reply in thread)
|
Beta Was this translation helpful? Give feedback.
-
|
I performed a stock adjustment and received an email notification but the email is missing any contents. Is it possible a text-only message is NOT sent and only the HTML version? ? I.e. WebERP sends an HTML version to PHP mail(), then my system strips it off as only text mail is supported. Btw, I don't really understand email at all..... |
Beta Was this translation helpful? Give feedback.
-
As I use webERP, most of the PDF reports are meant for “self consumption” by the user generating it, because of the very granular role security system. In a very few circumstances, we need to forward a report by email to someone. So, if it is easy to add a button to "email a PDF" alongside "Print PDF", it's great. If it is a lot of work, I guess we can leave it for post v5. Anyway, the initial post was about the errors caused by the current htmlMimeMail library, and seems like PHPMailer is the way to go ahead.
I really don't understand much how the VPS is setup. The VPS supplier set it up for me, so I can't offer much info. If you need further details, I could ask. I am perfectly OK for the change from htmlMimeMail to PHPMailer. I will try it too ;-) @dalers: The stock adjustment email is text only, not HTML. Thanks, |
Beta Was this translation helpful? Give feedback.
-
|
Before I commit, is anybody against me replacing htmlMimeMail with PHPMailer or can I go ahead and do it? Tim |
Beta Was this translation helpful? Give feedback.
-
|
Unfortunately email from ReorderLevel.php is not working for me. Clicking "Email" in ReorderLevel.php results in "This page isn’t working weberp.dalescott.net is currently unable to handle this request. HTTP ERROR 500" (after 30 seconds of "Loading" in the Chrome tab). Error in Apache error log: Also, I needed to first increase the size of the password field in the emailsettings table to allow SendGrid's 70-char crypto key ("varchar(80) NULL"), otherwise attempting to save SMTP Server Settings with a 70-char password silently fails for the user. Error in Apache error log: |
Beta Was this translation helpful? Give feedback.
-
|
Hi @timschofield: I tested StockAdjustments.php with STMP and works OK with my STMP host server. ;-) Thanks. I also tested a function SendEmailFromWebERP to encapsulate the email handling, in case in the future there are further adjustments, we only need to modify one function around webERP. I added these 3 lines on top of MiscFunctions.php And then this function: Then in StockAdjustments.php the email bits gets simpler: If you agree, I can commit it and the modifications in all scripts sending emails should be easier. Thanks, |
Beta Was this translation helpful? Give feedback.
-
|
Fyi both ReorderLevel.php and StockAdjustments.php are working correctly with SendGrid SMTP mail relay using domain authentication. I could quibble with email subject lines but that's just me ;-) I'm very pleased and happy! :-) |
Beta Was this translation helpful? Give feedback.
-
|
As all email handling in webERP has been updated to PHP Mailer, can we close this discussion? |
Beta Was this translation helpful? Give feedback.
-
|
Yes we can Ricard. As you did the bulk of the work do you want the pleasure of removing the htmlMimeMail.php file? :) |
Beta Was this translation helpful? Give feedback.




Uh oh!
There was an error while loading. Please reload this page.
-
Deprecated: define(): Declaration of case-insensitive constants is deprecated in C:\Jaisantex\www\casitadelpan\includes\htmlMimeMail.php on line 183
Deprecated: define(): Declaration of case-insensitive constants is deprecated in C:\Jaisantex\www\casitadelpan\includes\htmlMimeMail.php on line 187
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; smtp has a deprecated constructor in C:\Jaisantex\www\casitadelpan\includes\smtp.php on line 13
Deprecated: define(): Declaration of case-insensitive constants is deprecated in C:\Jaisantex\www\casitadelpan\includes\smtp.php on line 10
Deprecated: define(): Declaration of case-insensitive constants is deprecated in C:\Jaisantex\www\casitadelpan\includes\smtp.php on line 11
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Mail_RFC822 has a deprecated constructor in C:\Jaisantex\www\casitadelpan\includes\RFC822.php on line 25
Deprecated: Non-static method smtp::connect() should not be called statically in C:\Jaisantex\www\casitadelpan\includes\htmlMimeMail.php on line 690
Fatal error: Uncaught Error: Using $this when not in object context in C:\Jaisantex\www\casitadelpan\includes\smtp.php:91 Stack trace: #0 C:\Jaisantex\www\casitadelpan\includes\htmlMimeMail.php(690): smtp::connect() #1 C:\Jaisantex\www\casitadelpan\includes\MiscFunctions.php(358): htmlMimeMail->send() #2 C:\Jaisantex\www\casitadelpan\StockAdjustments.php(385): SendMailBySmtp() #3 {main} thrown in C:\Jaisantex\www\casitadelpan\includes\smtp.php on line 91
Como se puede arreglar ?
J
Beta Was this translation helpful? Give feedback.
All reactions