Lamp - PHP mailer not working after last lamp and mail apps update

Strange. Maybe the full path is needed?

runagent -m webserver1 podman exec php7.4-fpm /usr/bin/openssl version

BTW, usually runagent -m webserver1 should work but you wrote /usr/local/bin/runagent -m webserver1
I think you used su to get root but to get the right environment, you should use

su -

This way just runagent without the path should work.

Thank you for clarification @mrmarkuz.
But neither these attempts work:

[root@hur-ns8 ~]# runagent -m webserver1 podman exec php8.2-fpm /usr/bin/openssl version
Error: crun: executable file /usr/bin/openssl not found: No such file or directory: OCI runtime attempted to invoke a command that was not found
[root@hur-ns8 ~]# runagent -m webserver2 podman exec php7.4-fpm /usr/bin/openssl version
Error: crun: executable file /usr/bin/openssl not found: No such file or directory: OCI runtime attempted to invoke a command that was not found

That’s really strange.

Do you have the latest webserver version installed?

Yes, I do:

Sorry, openssl isn’t installed by default. It was a testing machine where I installed openssl manually some time ago


So to test if it works from inside the container you could install openssl with following commands: (After restarting webserver, openssl isn’t installed anymore, it’s not persistent)

runagent -m webserver1 podman exec php7.4-fpm apt update
runagent -m webserver1 podman exec php7.4-fpm apt install openssl -y

Now following test should show if you can connect to the hosts mailserver:

EDIT:

I was able to send a mail with phpmailer by using 10.5.4.1 (wireguard IP) as mail server and adding the following to the script as recommended here.

$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer'       => false,
'verify_peer_name'  => false,
'allow_self_signed' => true
)
);

Do you think we need to add openssl in the base image of php-fpm ?

Saying that because we did not add the smtp settings of the smarthost inside webserver

1 Like

I think it could be useful.
For sending via the local mail instance, disabling SSL and send via 10.5.4.1:25 should be ok but for reaching external (mail) servers it’s needed. (openssl + ca-certificates)

1 Like

Hi,
if I undestand well, the Webserver app is not ready yet to deploy projects which involve sending e-mails?
If so, I will probably have to turn back for my current project to the LAMP app again, where this works (despite I would otherwise prefer a bit more the Webserver app, partly for being 2/5 certified, and also for the possibility to create virtual hosts direcly from admin webgui, which is not possible in the Lamp app, if I get it right).

No, sending mails is working without SSL and by using the wireguard IP on port 25, see Lamp - PHP mailer not working after last lamp and mail apps update - #25 by mrmarkuz

$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer'       => false,
'verify_peer_name'  => false,
'allow_self_signed' => true
)
);

    //Server settings
    $mail->isSMTP();                                  //Send using SMTP
    $mail->Host       = '10.5.4.1';                   //Set the SMTP server to send through
    $mail->SMTPAuth   = false;
    $mail->Username   = 'markus';                     //SMTP username
    $mail->Password   = 'Secret123';                  //SMTP password
    $mail->Port       = 25;

Yes, that’s correct.

1 Like

Great! Thank you very much for pointing me the right way. Perfect solution for my project. Thanks!

1 Like