Upgrade from fedora 41 to fedora 42 php mail() issues stopped working

I am at a loss.

I did not see if the new fedora upgrade would upgrade php, but it feels like it did, or simply overwrote my php.ini.

Once I rebooted into the upgrade Fedora 42 and opened my development environment, my error logs are reporting new deprecated php functions it didn’t before (either because php.ini has changed and is reporting all or php was upgraded I’m thinking).

Anyway, I use mail() to send emails to my local postfix. Now mail() just return false all the time, no emails are sent, nothing is logged or errors and I haven’t changed anything. Unfortunately, I did not backup anything related to php files.

There is nothing wrong with postifx as I can send to my local domain.

Here is a snippet of my php.ini

[mail function]
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; https://php.net/sendmail-path

sendmail_path = /usr/sbin/sendmail -t -i

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail().
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off

; Use mixed LF and CRLF line separators to keep compatibility with some
; RFC 2822 non conformant MTA.
mail.mixed_lf_and_crlf = Off

; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =
; Log mail to syslog (Event Log on Windows).
;mail.log = syslog

@vgaetera like at a terminal?
at the terminal, on my system, if I do

echo "Subject: TEST" | /usr/sbin/sendmail -v myemail@fedora.local I can get its mail

@vgaetera

empty output

gstlouis@fedora:~$ -P sendmail
bash: -P: command not found...
gstlouis@fedora:~$ type -P sendmail
gstlouis@fedora:~$ 

@vgaetera

gstlouis@fedora:~$ echo ${PATH}
/home/gstlouis/.local/bin:/home/gstlouis/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/var/lib/snapd/snap/bin
gstlouis@fedora:~$ ls -l /usr/*bin/sendmail
ls: cannot access '/usr/*bin/sendmail': No such file or directory
gstlouis@fedora:~$ 

@vgaetera
You are correct.

well clearly the fedora upgrade must have omitted the sendmail package as this was working just fine before. Why would they do that? Or Why would this have happened? Should I report this to Fedora in case?

I expected my configuration not to have changed.

gstlouis@fedora:~$ rpm -q sendmail
package sendmail is not installed
gstlouis@fedora:~$
gstlouis@fedora:~$ dnf install sendmail
*
*
Package                                           Arch         Version                                            Repository                      Size
Installing:
 sendmail                                         x86_64       8.18.1-5.fc42                                      fedora                       1.7 MiB
Installing dependencies:
 procmail                                         x86_64       3.24-8.fc42                                        fedora                     365.1 KiB
 tinycdb                                          x86_64       0.80-4.fc42                                        fedora                      55.1 KiB

@vgaetera
Thanks for your time and help on this.

1 Like

You can get to the logs with sudo dnf system-upgrade log command.
If you have more then one upgrade log then you need to the add the --number=N option.

Look for lines that include sendmail. Maybe one of them says “Removing”?

Side note:

The PHP mail function requires a properly configured MTA (so the sendmail command)

It is usually recommended to prefer some mailing library such as phpmailer or symfony/mail which allows direct connection with some external MTA, giving authentication parameters.

@remi
I do agree to use PHPMailer to avoid headaches. However, I wanted to experience more complexity (or just give myself a hard time) with the mail command, as my cloud server uses mail locally anyways and see how far I can go with it automating attachments and doing html tables for pretty automated emails etc. I did learn a lot.

@vgaetera
Thanks for the command. I got empty details when I did this below I believe a couple of days after the upgrade. maybe log rotation already? Many updates since so may not be worth fetching since.

gstlouis@fedora:~$ sudo dnf system-upgrade log
[sudo] password for gstlouis: 
No logs were found.
gstlouis@fedora:~$ 

thanks all