vbcoach Posted March 8, 2022 Author Share Posted March 8, 2022 On 3/5/2022 at 9:13 PM, gizmola said: Ok, let me clarify a few things for you. There is no such thing as phpmail. You are introducing confusion thinking that such a thing exists. PHP has a mail() function, which is somewhat configurable via the php.ini. By default it pipes mail input directly to whatever the local "Mail transfer agent" aka "MTA" is. The MTA is operating system dependent, but it's some server process that implements Simple Mail Transfer Protocol (SMTP) which is the protocol mail *servers* use to send and receive emails. Whether or not those emails actually get sent as expected or received, after mail has been called, has many complicated issues associated with it, and is the domain of experienced email system administrators. In your case, that is entirely within the purview of Network Solutions. I will offer just a few issues: To send email requires DNS, specifically MX records for a domain. In most cases systems are not sending email directly out of a specific application server. They instead are using the hosting companies email servers. To send email on behalf of a domain requires at very least SPF, and increasingly DKIM setups for the email servers on behalf of a domain The network solutions script is a red herring. We need to see what your script is doing. There are many ways to send email. We also need to understand more about these emails you send. What is the from address? Is it from you at your domain? What do the headers look like for the test emails you can send out? Is NS proxying your emails for you? What code packages the "html" version THe RFC's for how emails work has specific requirements for what an email is supposed to look like. An "html" email is not a replacement for a standard email. Technically an html email is just a attached version of the email that should be packaged with an original ascii only version. Email clients then will retrieve the html version and display that. Many email systems are highly fault tolerant, and not unlike the way browsers will tolerate broken html and still display something for you in most cases, that doesn't mean you should or your software should ignore the standard and correct format for emails. It is never correct to take code that would send an html email and then just add html tags to the body and send that instead, even if it has worked for you to some degree in the past. Some email systems will reject that email outright and you will likely never know that they were rejected. Some mail clients won't work or the email will look bad. Viewing html emails is actually a choice for the email client. Some people use clients that don't render html or they intentionally turn it off. That might be the minority, but it is another reason to have a properly constructed email. You really have a number of issues: You have limited control of your hosted environment? You aren't an expert on how email administration works or php You're running a really old script on a version of php that has been End of life for a long time You don't seem to have any test environment, so you're experimenting with your production environment, with limited visibility into that Apparently your script has some bugs, but again we haven't seen it, or any portion of it. To summarize. Yes you should use PHP 7.4 (at minimum). That is the *oldest* supported PHP version available. You might very well be better served by using one of the many current supported PHP mail libraries rather than something as low level and hosting dependent as mail(). For example, many libraries actually implement SMTP themselves, and give you a lot more control over the process of sending emails programmatically, while at the same time insuring that the delivered email data is actually compliant with email standards For any email sending you need a good handle on the questions I raised previously (how will you actually "send" email, in terms of what user@domain the email is coming from. Is this from your domain, and if so, is the email setup for the domain valid and workable. Anyone can setup something that "delivers" emails via smtp that will promptly be rejected or accepted and deleted with you never being the wiser. Here is an article talking about the best known php mailer libraries. The ones I would suggest considering are listed below. phpmailer https://github.com/PHPMailer/PHPMailer Probably this is the library you should use in renewing your existing email script. symfonymail https://symfony.com/doc/current/mailer.html This took over for the popular swiftmailer you may see mentioned as an alternative The php Composer tool was released a decade ago. There is no excuse left for a project that is not using composer to manage your dependencies. This is also why you probably need a dev/test environment within which you can run composer. Composer will download and manage your dependencies. It will build a standards compliant autoloader for your application that you include so that class libraries like phpmailer can be properly autoloaded Porting your email script is probably the path to getting something reliable and supported. I hope this helps you start moving yourself in the right direction. If you want to start answering some of the questions I posed, and need help and advice in doing so, feel free to follow up. Sending email seems simple but it has become a very complicated endeavor over the years, and like many things that seem simple on the surface, have a lot of hidden complexity to them, especially when things go wrong. This was one of the most thoughtful, well written responses I have ever had on this forum in all the years that I have been on here. You are spot-on in regards to my skill set, but I have had to learn everything on my own. Thank you for your thoughtful (and not demeaning) response. Quote Link to comment https://forums.phpfreaks.com/topic/314569-phpmail-stopped-sending-html-based-emails/page/2/#findComment-1594326 Share on other sites More sharing options...
gizmola Posted March 9, 2022 Share Posted March 9, 2022 Glad to have been of help. Lately I've been doing quite a lot of email configuration and administration, that just reminds me how important all these different elements are for email delivery. Being able to setup SPF records correctly, reverse DNS, DKIM (which also requires some substantial sysadmin configuration if running your own MTA) and topping it all off with DMARC, is a great reminder of how complicated email sending now is, especially if you don't want your emails rejected. I was just debugging something that involved IP's on a couple of RBL lists due to spammers coming from a few hundred of over 100k ip's the hosting company controls. What a nightmare! Quote Link to comment https://forums.phpfreaks.com/topic/314569-phpmail-stopped-sending-html-based-emails/page/2/#findComment-1594337 Share on other sites More sharing options...
gizmola Posted March 9, 2022 Share Posted March 9, 2022 This also reminds me that I recently came across this channel, and he provides some of the best modern PHP topic tutorials I've seen. Very lucid explanations and examples. These might help you climb the mountain of stuff I brought up: While there is mention of PHP8 for a lot of these, most if not all the material is relevant to 7.4 as well, and even earlier versions, although they are all pretty much end of life at this point. I didn't watch this one, but it looks promising for the email topic: Quote Link to comment https://forums.phpfreaks.com/topic/314569-phpmail-stopped-sending-html-based-emails/page/2/#findComment-1594338 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.