codeigniter4/settings

Credentials not load from DB

Memurame opened this issue · 2 comments

Good day
I have the Settings extension in use.
As far as I understood the extension should load the data directly from the DB.
Unfortunately this does not work.
I have saved the connection data from the e-mail in the DB and now I want that they are automatically loaded when I want to send a mail.

MyCodeigniter version

"php": "^7.4 || ^8.0",
"codeigniter4/framework": "^4.3.2",
"codeigniter4/settings": "^2.1"

In my test controller I have inserted a simple mail dispatch which works otherwise perfectly if I insert the access data directly into the .env.
I put these parameters in the .env file and it works.

email.protocol = 'smtp'
email.SMTPHost = 'galvani.metanet.ch'
email.SMTPUser = 'no-reply@domain.ch'
email.SMTPPass = 'oS7XV8L'
email.SMTPPort = '465'
email.SMTPCrypto = 'ssl'
email.mailType = 'html'
email.fromEmail = 'no-reply@domain.ch'
email.fromName = 'Test Name'
$email = \Config\Services::email();
$email->setTo('mail@mail.ch');
$email->setFrom('abs@mail.ch');
$email->setSubject("Überfällige Rechnung");
$email->setMessage("Test");
if ($email->send())
{
    echo 'Email successfully sent';
}
else
{
    $data = $email->printDebugger();
    print_r($data);
}

When testing, I get the following error message:

You did not specify a SMTP hostname.
Unable to send email using SMTP. Your server might not be configured to send mail using this method.
Date: Fri, 3 Mar 2023 22:17:48 +0100
To: trash@hirter.dev
From: "Your Name" <no-reply@hirter.dev>
Return-Path: <no-reply@hirter.dev>
Subject: =?UTF-8?Q?=C3=9Cberf=C3=A4llige=20Rechnung?=
Reply-To: <no-reply@hirter.dev>
User-Agent: CodeIgniter
X-Sender: no-reply@hirter.dev
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <640263fc4b6234.65090062@hirter.dev>
Mime-Version: 1.0


Content-Type: multipart/alternative; boundary="B_ALT_640263fc4b65a0.11427116"

This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ALT_640263fc4b65a0.11427116
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Meine


--B_ALT_640263fc4b65a0.11427116
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Meine

--B_ALT_640263fc4b65a0.11427116--

Can anyone help me?
Thank you very much.
Greetings Tom

And how did you resolve your issue?

And how did you resolve your issue?

That was a long time ago.
Unfortunately, I can't tell you anymore.

I think I made a mistake.
Sorry.