Auth with SMTP

72 views
Skip to first unread message

Matthew Brown

unread,
Jun 14, 2022, 2:30:33 PM6/14/22
to Fat-Free Framework
Hello,

I'm try go get Auth working with SMTP as the storage resource. I can't get it to work and assume I'm making some fundamental mistake. Does anyone have an example or some sudo code of what this would look like? Ideally I'd like to make this work with HTTP basic authentication, but I've been trying Login as well. My latest config attempt is:

$user = new \SMTP('localhost', 25, NULL, $username, $password);
$auth = new \Auth($user, array('id' => 'username', 'pw' => 'password'));
$auth->basic();

I've also tried changing from basic to login:
$login_result = $auth->login('emailusername', 'emailpassword');

I assume the issue is with how I'm initializing or calling the SMTP storage as I get this error:
Object of class SMTP could not be converted to string.

I've tried other ports and SSL & TLS as well, with the same result.

Any pointers would be greatly appreciated.

ikkez

unread,
Jun 18, 2022, 2:35:29 AM6/18/22
to Fat-Free Framework
Hi..

funny I didn't even knew that this was possible at all :D
I checked the code that it appears that SMTP cannot just be used here.. syntax is:

$auth = new \Auth('smtp', [
    'host' => 'smtp.domain.com',
    'port' => 25,
    'scheme' => null,
]);
$auth->basic(); 

Matthew Brown

unread,
Jun 22, 2022, 12:25:21 PM6/22/22
to ikkez über Fat-Free Framework
Thanks for confirming the correct syntax. I tested it and this works. Yeah, I was surprised to see this feature too. I happen to have a use case for this and it is perfect for my app.

--
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Fat-Free Framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/f3-framework/6NZX1s8uEUs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to f3-framework...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/ddf1479f-0527-4387-b66e-240048b1bf44n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages