Papa Dragon wrote the following
post Mon, 11 Mar 2024 14:41:47 -0700
Hi, all @!
Streams connoisseurs,
I'm beginning to work on a tool to configure the phpmailer addon from the YunoHost admin interface. If I'm not mistaken, the configuration must be made in the .htconfig.php file. In the YunoHost package, this file is regenerated each time there's an update of the package.
I could add an option to save the phpmailer settings somehow using the
YunoHost helpers, so that they could also be safely regenerated during each package update, but it looks like a lot of work compared to storing them in a separate which would remain untouched during the update.
So, my big question is: can I safely use an
include
in .htconfig.php? The idea would be to have a separate file, say .mailerconfig.php, that would first look like this:
<?php// Mail configuration// By default, uses local sendmail service// Only change these settings if you require SMTP transport// App::$config['phpmailer']['mailer'] = 'smtp';// App::$config['phpmailer']['host'] = 'example.com';// Leave this line commented if using SSL or STARTTLS and set the port in the next sections// App::$config['phpmailer']['port'] = 25; // (or 587 or 465 if using ssl)// If using smtp authentication:// App::$config['phpmailer']['smtpauth'] = 1;// App::$config['phpmailer']['uername'] = 'your_username';// App::$config['phpmailer']['password'] = 'your_secret_password';// If using starttls:// App::$config['phpmailer']['smtpsecure'] = 'tls';// App::$config['phpmailer']['port'] = 587;// If using ssl:// App::$config['phpmailer']['smtpsecure'] = 'ssl';// App::$config['phpmailer']['port'] = 465;// If the server has a self-signed cert:// App::$config['phpmailer']['noverify'] = 1;// For debugging// App::$config['phpmailer']['smtpdebug'] = 2; // valid values are 0-4// These settings should work for 99% of use cases// If you encounter any issues, please see https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting// If you need to extend these configuration options, please submit a pull request with your changes.?>
and could then be modified through the YunoHost admin interface (which would send
sed
/
awk
commands to change the file).
I'm sorry if the question sounds a little silly, but you have to remember that I never learned how to code before I started coding 🤪
@
Papa Dragon