Php mail script upgrade

This is a php script, which basically does the send mail function via terminal shell, I am studying it and the curious thing is that it worked in my tests only in the Ubuntu 14.04 versions with php5 and postfix. But I could not get it to work on Ubuntu 18.04 or Debian 9. I would like to ask for help to change the code in order to make it work in those versions. Thank you.

javali.php
Jacques LaurenceAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Zakaria AcharkiAnalyst DeveloperCommented:
Where is the script?
Jacques LaurenceAuthor Commented:
The php file is attached
Zakaria AcharkiAnalyst DeveloperCommented:
But I could not get it to work on Ubuntu 18.04 or Debian 9

Is there any error message or any output? We need to know what you mean by could not get it to work.

Do you get any output from echo statements?
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

Jacques LaurenceAuthor Commented:
Can you take a practical test? Do you have any 18.04 ubuntu server or debian 9 server?
Zakaria AcharkiAnalyst DeveloperCommented:
Unfortunately, I don't have anyone from them that why I'm trying to know from you what happens exactly when you execute the PHP script.
Julian HansenCommented:
Have you considered migrating the script to use PHPMailer (https://github.com/PHPMailer/PHPMailer)

It takes a lot of the hassle out of sending emails from PHP.
Dave BaldwinFixer of ProblemsCommented:
What SMTP email server (like Postfix) is installed on the other systems?  You can't send email without a SMTP server.
Jacques LaurenceAuthor Commented:
The interesting thing is to make it work in other distros just like it works on ubuntu 14.04. The idea is to make the script work on Ubuntu 18.04 as well. Works on ubuntu 14.04 with Postfix
Dave BaldwinFixer of ProblemsCommented:
SMTP servers which are required for the PHP mail() function to work are NOT automatically installed on the LInux systems I have.  I had to do the install myself.
Jacques LaurenceAuthor Commented:
In the description I explained that it is installed and works on ubuntu 14.04, the point is that even with everything installed and configured correctly it does not work in the most current versions of ubuntu (16.04, 18.04)
Zakaria AcharkiAnalyst DeveloperCommented:
Then you need to debug your code to know where exactly the script stops, it does not work doesn't help us so much to identify the problem source, share with us the output of your script, screenshots, anything could help us to help you...
Jacques LaurenceAuthor Commented:
the problem is that it does not generate any error or log message
Dave BaldwinFixer of ProblemsCommented:
SMTP program requirements.
http://php.net/manual/en/mail.requirements.php

mail() configuration.
http://php.net/manual/en/mail.configuration.php

And according to this page http://php.net/manual/en/function.mail.php , your code does not have a 'message body' or content.
Jacques LaurenceAuthor Commented:
Dave Baldwin It works fine on Ubuntu 14.04 with postfix and php5
Dave BaldwinFixer of ProblemsCommented:
Dave Baldwin It works fine on Ubuntu 14.04 with postfix and php5
 You have already said that.  But you seem to be ignoring my comment that Postfix or Sendmail are NOT installed by default... but are Required by the PHP mail() function.  The Ubuntu and CentOS installations that I have did NOT have a SMTP server installed until I installed it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.