mirror of
https://github.com/cypht-org/cypht.git
synced 2026-04-25 04:56:03 +03:00
[GH-ISSUE #291] SMTP Issue using Functional Login #251
Labels
No labels
2fa
I18N
PGP
Security
Security
account
advanced_search
advanced_search
announcement
api_login
authentication
awaiting feedback
blocker
bug
bug
bug
calendar
config
contacts
core
core
devops
docker
docs
duplicate
dynamic_login
enhancement
epic
feature
feeds
framework
github
github
gmail_contacts
good first issue
help wanted
history
history
imap
imap_folders
inline_message
installation
keyboard_shortcuts
keyboard_shortcuts
ldap_contacts
mobile
need-ssh-access
new module set
nux
pop3
profiles
pull-request
question
refactor
release
research
saved_searches
smtp
strategic
tags
tests
themes
website
wordpress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/cypht#251
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @malik-asghar on GitHub (Oct 11, 2018).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/291
Originally assigned to: @jasonmunro on GitHub.
Hi Guys, I have integrated Cypht into my existing project. Here is stranger behavior of Cypht when I am directly Logging into Cypht I am getting configuration for IMAP and SMPT and it is working fine for sending and receiving emails.
But when I try to Login using Functional Login I am getting Error for SMTP Server settings but IMAP settings are working fine.
Any help will be appreciated.
require '/modules/api_login/api.php';
cypht_login($user, $pass, $url);
https://github.com/jasonmunro/cypht/wiki/API-Login
@jasonmunro commented on GitHub (Oct 11, 2018):
Hi @malik-asghar, thanks for the feedback. I'm happy to help figure this out. Can you tell me the specific error you are seeing for the SMTP server?
@malik-asghar commented on GitHub (Oct 11, 2018):
@jasonmunro I am getting this Error "You need at least one configured SMTP server to send outbound messages".
I have checked hm3.ini file and SMTP settings are correctly added to this file. These settings are working fine when directly logging into Cypht but not working with Functional Login.
@jasonmunro commented on GitHub (Oct 11, 2018):
@malik-asghar I see the issue. the default SMTP server is only being added when the user logs in normally. I will work on a fix and let you know when it's ready!
@malik-asghar commented on GitHub (Oct 11, 2018):
That will be great. Can you share the details about the problem?
@jasonmunro commented on GitHub (Oct 11, 2018):
The problem is here:
https://github.com/jasonmunro/cypht/blob/master/modules/smtp/modules.php#L37
This module fires on any page load when the user is logged in, but the first thing it does is look for a form (HTTP POST) with the username and password (this is the login form). If found, it collects the users configured SMTP servers, and adds the default from the hm3.ini file to the list. When using the functional login, there is no HTTP POST login form, so the code is never executed, and the default server is never added.
I think the best way to fix this is to remove the check for the login form, analyze the user's list of SMTP servers, and add the default if it's not in the list yet. Once it has been added, I will set a flag indicating that, and we can short circuit the module when that flag is set to avoid unneeded overhead.
@jasonmunro commented on GitHub (Oct 11, 2018):
on closer examination I think I can remove this module completely, and do a "just in time" check during the module that loads SMTP servers for pages that need them to add the default if it's not there. This would be less overhead than what I described earlier, but similar (and less code!).
@jasonmunro commented on GitHub (Oct 11, 2018):
Well I started to fix this but realized it won't be as easy as I thought :) In order to configure the default SMTP server on login, we need the username and password, which is why it was built to run when the login form is submitted. I have a plan on how to fix this in a generic way such that any module set that needs to do work during the login flow will work with both standard login and functional login process, but this will take some work. The api login (not the functional way) should work, so you could try that until this is fixed. Sorry about that!
@jasonmunro commented on GitHub (Oct 11, 2018):
@malik-asghar fix pushed to the master branch. Could you grab the latest code and see if it works for you? thanks!
@malik-asghar commented on GitHub (Oct 11, 2018):
Great @jasonmunro . The issue is solved, and now SMTP is working fine. There is another issue, I have replied back to that email, when I clicked on Reply in receiver filed there was just my Outbound E-mail Domain "example.com" where as there should user@example.com.
Secondly I did not received replied email.
To check IMAP I just compose Email to user@example.com and I received that email. But first email which was reply is missing. I have got notification of Email received but it is not showing anywhere.
@malik-asghar commented on GitHub (Oct 12, 2018):
There is one more thing, and your guidance will be appreciated.
I want to hide
when using Functional Login.
@jasonmunro commented on GitHub (Oct 12, 2018):
@malik-asghar the best way to handle this is to create a profile so you can tie an IMAP server and SMTP server together and define your reply-to address, display name, etc - however, it should still default to something sane when you don't have a profile setup - so this could be a bug. I will check into it.
@jasonmunro commented on GitHub (Oct 12, 2018):
This is what the site module set is for. With this module set enabled, you can override modules from other sets and easily disable them. To remove menu entries, you need to figure out which modules you want to override, and for each one add a line of code to the modules/site/setup.php file to disable them. I will put together an example for you shortly.
@jasonmunro commented on GitHub (Oct 12, 2018):
@malik-asghar can you provide me with the raw content of the first E-mail, the one you then tried to reply to? You can get that by opening the message in Cypht and clicking on the "Raw" link below the headers. I think the problem is with the original message not the reply logic. Thanks!
@malik-asghar commented on GitHub (Oct 12, 2018):
Yeah sure. Here it is:
Authentication-Results: dev.example.com;
dkim=temperror header.i=masghar@example.com
Return-Path: masghar@example.com
X-Original-To: masghar@example.com
Delivered-To: masghar@example.com
Received: from dev.example.com (unknown [69.28.224.181])
by dev.example.com (Postfix) with ESMTPSA id A0CCEA0238
for masghar@example.com; Fri, 12 Oct 2018 10:49:34 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com;
s=default; t=1539355774;
bh=WoRpXkhNls8oH5aamGp+VSmWBDHmaE/JPV+yE6Qzkis=; l=529;
h=From:To:Subject;
b=GdSlVJsLDj0qSOKQUBSvihVAZB50IgQe1pd/E+1gDO+/tSk79lNx2lPsI4SJPh2if
vtVFtX9c1pLP7PztQqCtEK0d7EkZTE56LXQrBh6X02yEiGbVFFUswn07LkPvJNLurF
cWMdR9lwR75Gj3DG6SGa4rt7/SmaLOthFA4kLIvw=
X-Mailer: Cypht
MIME-Version: 1.0
From: masghar@example.com
Reply-To: @example.com
To: malik.asghar.bubak@gmail.com
Subject: Email for Raw Content Check
Date: Fri, 12 Oct 2018 14:49:34 +0000
Message-Id: e79156a65b8a8380767ed2d9180dca7e@dev.example.com
Content-Type: multipart/alternative;
boundary=YicmdLnKqEcKN6H0KaPcpSUyaMsSGmuHA6Cx5HRJZxtUBTqd2bpYYKmTRe6UmYlf
X-Auto-Bcc: cypht
X-PPP-Message-ID: 20181012144934.20234.38363@dev.example.com
X-PPP-Vhost: example.com
--YicmdLnKqEcKN6H0KaPcpSUyaMsSGmuHA6Cx5HRJZxtUBTqd2bpYYKmTRe6UmYlf
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
This is email for checking RAW content of the email=2E
--YicmdLnKqEcKN6H0KaPcpSUyaMsSGmuHA6Cx5HRJZxtUBTqd2bpYYKmTRe6UmYlf
Content-Type: text/html; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
This is email for checking RAW content of the email=2E
@malik-asghar commented on GitHub (Oct 12, 2018):
Got it. It is due to Profile Settings. I have to create profile. But Is there anyway that there should be option in hm3.ini file for Creating default profile when installing Cypht. Like there are options for IMAP and SMTP, there should be Option to create Profile and in this profile IMAP and SMTP should be set for default profile. It will be more useful and it will save time.
@jasonmunro commented on GitHub (Oct 12, 2018):
This is a bug and needs to be fixed since it's an invalid E-mail header. You should be able to properly send mail even without a profile being setup.
We don't have any support for that unfortunately, but it's a good idea. I will open a new issue for this feature request.
@jasonmunro commented on GitHub (Oct 12, 2018):
@malik-asghar Ok, here is what you need to do:
Let me know if you run into any problems!
@jasonmunro commented on GitHub (Oct 12, 2018):
@malik-asghar a fix for this is pushed to the master branch. Make sure you have default_email_domain set in your hm3.ini file.
@malik-asghar commented on GitHub (Oct 15, 2018):
It is working fine now. Thanks.
@malik-asghar commented on GitHub (Oct 15, 2018):
Great @jasonmunro it is fixed and Now Cypht looking awesome when Embedded in any System.
@malik-asghar commented on GitHub (Oct 15, 2018):
It is very useful when you are embedding Cypht in any system. I will be waiting for this update. Thanks
@jasonmunro commented on GitHub (Oct 17, 2018):
@malik-asghar I created a new issue for default profiles here: https://github.com/jasonmunro/cypht/issues/293 It's easier for me to keep track of things if issues are limited to a single thing :). I think everything else brought up in this thread is resolved so I'm going to close it. If there is something else besides default profile support that is not resolved, please open a new issue for it. Thanks!