Jacques Laurence
asked on
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
javali.php
Where is the script?
ASKER
The php file is attached
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?
ASKER
Can you take a practical test? Do you have any 18.04 ubuntu server or debian 9 server?
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.
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.
It takes a lot of the hassle out of sending emails from PHP.
What SMTP email server (like Postfix) is installed on the other systems? You can't send email without a SMTP server.
ASKER
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
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.
ASKER
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)
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...
ASKER
the problem is that it does not generate any error or log message
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.
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.
ASKER
Dave Baldwin It works fine on Ubuntu 14.04 with postfix and php5
Dave Baldwin It works fine on Ubuntu 14.04 with postfix and php5You 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.
dave gave the proper indications :
the mail php function relies on the system's sendmail command.
- this requires to be configured in php. check with phpinfo
- this requires the sendmail command to exist on the system. if postfix is installed, it does. be careful : you might be running in an fpm chrrot
- this requires the local MTA to be running and pickup to be configured properly. this should be the case with a postfix default install.
the php config can be checked with phpinfo and be enabling error output : the mail function will throw an error if it is unhappy.
the mail config can be tested by sending a mail from the command line using the mail command.
also try to tail /var/log/maillog or mail.log whichever exist
the mail php function relies on the system's sendmail command.
- this requires to be configured in php. check with phpinfo
- this requires the sendmail command to exist on the system. if postfix is installed, it does. be careful : you might be running in an fpm chrrot
- this requires the local MTA to be running and pickup to be configured properly. this should be the case with a postfix default install.
the php config can be checked with phpinfo and be enabling error output : the mail function will throw an error if it is unhappy.
the mail config can be tested by sending a mail from the command line using the mail command.
also try to tail /var/log/maillog or mail.log whichever exist
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.