Jump to content

J23

Members
  • Content Count

    29
  • Joined

  • Last visited

Posts posted by J23


  1. Hello, I cannot install this new version in Delphi 2010, Windows11.

    I receive the error:

    "Checking project dependencies...
    Compiling OverbyteIcsD2010Run.dproj (Debug configuration)
    [DCC Warning] OverbyteIcsD2010Run.dpk(190): W1033 Unit 'SHDocVw' implicitly imported into package 'OverbyteIcsD2010Run'
    [Exec Error] The command "cd ..
    if not exist Lib\Debug\Win32\D2010 mkdir Lib\Debug\Win32\D2010
    if not exist Lib\Release\Win32\D2010 mkdir Lib\Release\Win32\D2010
    copy Source\OverbyteIcsTnOptFrm.dfm Lib\Debug\Win32\D2010\OverbyteIcsTnOptFrm.dfm
    copy Source\OverbyteIcsOAuthFormVcl.dfm \Lib\Release\Win32\D2010\OverbyteIcsOAuthFormVcl.dfm
    copy Source\OverbyteIcsTnOptFrm.dfm Lib\Release\Win32\D2010\OverbyteIcsTnOptFrm.dfm
    copy Source\OverbyteIcsOAuthFormVcl.dfm Lib\Release\Win64\D2010\OverbyteIcsOAuthFormVcl.dfm" exited with code 1.."

     

    I didn't have an older version installed, so I didn't need to uninstall it. I later tried to install version (8.58) and it worked. What could be the reason for the problem with version 9.0?

    Regards,

    J23

     


  2. 1 hour ago, Angus Robertson said:

    they are from V8.71

    I updated ICS.

     

    "WebBrowser Title: Could not connect to this page."

     

    With a different Redirect-URI

    for example http://localhost:8080/microsoft/

    I get the message:

    AADSTS50011: The redirect URI 'http://localhost:8080/microsoft/' specified in the request does not match the redirect URIs configured for the application '8...

    Azure settings attached. Of course, in Azure I also added such a setting - then there was a message as above. "Could not connect to this page."

     

    Did I understand correctly, can I send more details to your private email?

     

    J23

    Authentication.png


  3. Hello Angus, I am very grateful for your time.

    I tried to run the program on another computer, I removed the entire package and reinstalled. Nothing has changed.

    There was only one problem during the installation: I had to manually add the path to the file OverbyteIcsSuperXMLParser.pas

    I'd like to ask a few more questions:

    - the program didn't ask for certificates but maybe I should create some certificates?

    - are the settings visible in the REST Settings attachment sent yesterday are correct?

    - maybe unlucky compilation in Delphi2010 causes some unusual problems?

    - Maybe change the port to something other than 8080?

    - Is there a compiled (exe) version of this program available somewhere? I know it's dangerous, but I'm determined to try all the options 😉

    - I'm signing in with a trial Microsoft 365 work account - Microsoft 365 Business Basic - it doesn't matter?

     

    J23


  4. 1 hour ago, Angus Robertson said:

    Thank you very much Angus for your support. Unfortunately, it didn't help.

    In the meantime, I tried in that application using EASendMail to apply:

    scope = 'https://graph.microsoft.com/Mail.Send'

    and it works fine too.

     

    I noticed a strange thing: authentication requests sent from these apps are slightly different:

    (xxxx replaces long codes here)

    EASendMail (browser bar):

    https://login.microsoftonline.com/common/oauth2/v2.0/authorize?response_type=code&scope=https://graph.microsoft.com/Mail.Send&redirect_uri=http://127.0.0.1:60432&client_id=xxxx&prompt=login

     

    OverbyteIcsHttpRestTst: (Debugger -BrowserURL text from OverbyteIcsSslHttpOAuth unit)

    https://login.microsoftonline.com/common/oauth2/v2.0/authorize?response_type=code&client_id=xxxx&redirect_uri=http%3A%2F%2F127.0.0.1%3A8080&state=ICS-17630046&scope=https%3A%2F%2Fgraph.microsoft.com%2FMail.Send

     

    but the browser bar shows much more:

    https://login.microsoftonline.com/common/oauth2/v2.0/authorize?response_type=code&client_id=xxxx&redirect_uri=http%3a%2f%2f127.0.0.1%3a8080&state=ICS-17630046&scope=https%3a%2f%2fgraph.microsoft.com%2fMail.Send&sso_nonce=xxxx&client-request-id=xxxx&mscrid=xxxx

     

    Browser behavior is also different:

    EASendMail: Requests MailAddress, Password and SMS verification

    OverbyteIcsHttpRestTst: It requests MailAddress, Password and without SMS verification shows message:

    "Failed to Generate App Token............."

    The "............." looks like it's Authorization Code

     

    Even the login windows are slightly different graphically.

     

    Completely lost,

    J23


  5. On 3/7/2023 at 5:22 PM, Angus Robertson said:

    The ICS SMTP and MailQueue components will send email using Office365, again provided all the permissions are set in Azure.  Look at the OverbyteIcsMailQuTst.dpr sample

    Hello,
    It's been a few months and I've tried to get back on topic. However, now I managed to clear some doubts and my question is a bit more precise.
    I used the trial version of the EASendMail control. I was able to send the mail, so now I am sure that my application registration and its settings in Azure are correct.
    And here the problem arose. At first I thought I also verified all URIs, URLs, etc. are correct. However, the same settings applied to the Overbyte Demo did not allow me to get a Token.
    In the version with the EASendMail control, I have:

        clientID = ....
        clientSecret = ...
        scope = 'https://graph.microsoft.com/Mail.Send%20offline_access%20email%20openid';
        authUri = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize';
        tokenUri = 'https://login.microsoftonline.com/common/oauth2/v2.0/token';

    httpListener.Create1('127.0.0.1', 0);
    redirectUri := Format('http://127.0.0.1:%d', [httpListener.ListenPort]);//http://127.0.0.1:51034
        authorizationRequest := authUri;
        authorizationRequest := authorizationRequest + '?response_type=code&scope=' + scope;
        authorizationRequest := authorizationRequest + '&redirect_uri=' + redirectUri;//http://127.0.0.1:51034
        authorizationRequest := authorizationRequest + '&client_id=' + clientID;
        authorizationRequest := authorizationRequest + '&prompt=login';
    browserUi.OpenUrl(authorizationRequest);
    httpListener.GetRequestUrl(-1)
    requestUri := httpListener.RequestUrl;                             //have the AuthorizationCode!

    httpRequest := TServerXMLHTTP60.Create(nil);
            tokenRequestBody := 'code=' + code;
            tokenRequestBody := tokenRequestBody + '&redirect_uri=' + redirectUri;
            tokenRequestBody := tokenRequestBody + '&client_id=' + clientID;
            tokenRequestBody := tokenRequestBody + '&grant_type=authorization_code';

            httpRequest.setOption(2, 13056);
            httpRequest.open('POST', tokenUri, true);
            httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            httpRequest.send(tokenRequestBody);

            while( httpRequest.readyState <> 4 ) do
                httpRequest.waitForResponse(1);

            status := httpRequest.status;  //=200!
            result := httpRequest.responseText;                           //have the Token!

    *********************************************************************************

     

    What am I setting wrong in OverbyteIcsMailQuTst?

    When I try to "Login to App" with above Scope I get the message:

    AADSTS650053: The application xxx asked for scope 'Mail.Send%20offline_access%20email%20openid' that doesn't exist on the resource '00000003-0000-0000-c000-000000000000'. Contact the app vendor.

     

    Previously, I tried the default Scope setting: https://graph.microsoft.com/Mail.Send

    Then I get the message:

    Failed to Generate App Token

    but now the Authorization Code appears!

     

    Thank you in advance for any help. I feel like I'm going round in circles.

    J23

    OAuth2 settings.png

    REST settings.png


  6. 55 minutes ago, mjustin said:

    SMTP can still be used with basic auth. Modern Authentication is not required

    Neither GMail nor Microsoft allow Basic authentication

    https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/deprecation-of-basic-authentication-exchange-online

     

    The exception is the use of Application password, but my University that uses Office 365 mail does not agree to this solution.

     

    By the way: MS Technical Support says that the Outlook application cannot be configured to send mail (Microsoft account) using SMTP - i tried and i didn't make it.


  7. On 3/5/2023 at 9:01 PM, Angus Robertson said:

    OverbyteIcsHttpRestTst,dpr

    Hi,

    I tried but couldn't send an email.

    In the Send Email tab, I entered:

    - From:                                 my personal Outlook mail address

    - Recipients:                          my another mail address

     

    In the Email Settings tab, I entered:

    - Email Provider:                   Microsoft REST APIs

    - MS User Autority:              Consumers

    - App Client ID:                    App value from Azure

    - Client Secret:                      App value from Azure

    - Email Account:                    my personal Outlook mail address

    - OAuth Authentication:        Local Web Server

     

    I left all other fields unchanged. Should I enter anything else?

     

    I tried to run (Email Settings tab):

    Test Redirect button - Test Redirect OK

     

    Login to Email button - Browser shows message (without login screen):

    "unauthorized_client: The client does not exist or is not enabled for consumers. If you are the application developer, configure a new application through the App Registrations in the Azure Portal at https://go.microsoft.com/fwlink/?linkid=2083908."

     

    After change - MS User Autority: to common

    Login to Email button - Browser shows login screen, but when I tried to log with my personal Outlook mail address I was rejected with message:

    "You cannot log in here with your personal account. Use a work or school account instead."

     

    What am I doing wrong? The user of my application should authenticate the sending of the email with his data.

    Tried logging in with my Azure account details but of course no luck either.

    Thanks in advance for any help.

    J23

     


  8. 22 hours ago, Angus Robertson said:

    ICS has a TIcsRestEmail component that uses the graph.microsoft.com/v1.0/me/sendMail API, there is a sample in OverbyteIcsHttpRestTst,dpr

    Thanks for your reply.

    OverbyteIcsHttpRestTst,dpr successfully sends mails as OAuth2 from GMail - not from O365. It uses two components: HttpRest and RestOAuth.

    But I've not found TIcsRestEmail component. Would you be so kind as to tell me where to find it (and how to use it)?

    Inside this example, there is no such component.

    I've downloaded ICS-V8.58 (Nov, 2018).

    J23


  9. 53 minutes ago, Angus Robertson said:

    Never heard of Exchange Web Service protocol

    Maybe I didn't understand something?:

    https://www.emailarchitect.net/easendmail/kb/delphi.aspx?cat=15

    "Exchange Web Service (EWS)

    Exchange Web Services (EWS), an alternative to the MAPI protocol, is a documented SOAP based protocol introduced with Exchange Server 2007. We can use HTTP or HTTPS protocol to send email with Exchange Web Services (EWS) instead of SMTP protocol. I only suggest that you use EWS protocol in Exchange 2007/2010/2013/2016 or later version. Office365 also supports EWS very well."


  10. Hello,
    does ICS allow to send mail from Office365 account using the Exchange Web Service protocol?
    I want my app to be able to send emails from my Office 365 account.
    To start with, I decided to try GMail and SMTP. Thanks to ICS it was easy.
    I decided that now I will only change the configuration and send an e-mail from O365. Failed to.
    For O365 SMTP does not work even in Outlook (desktop). A few days ago I found out from MS technical support that now I can only send mail using Exchange.
    Is it true?
    Thanks for any help.
    J23
    

  11. On 2/8/2023 at 9:14 PM, Remy Lebeau said:

    pretty much anything you can with other REST components can also be done manually with TIdHTTP

    I tried and failed. I think I have the HTTPrequest correct: pasted directly into the browser it brings up the login window. After user accept, the browser reports the inability to connect to the localhost server. How to call default browser and receive response to get AuthCode? Of course without using REST.

    Once I get the AuthCode, I'll call IdHHTP.Post method and get the Token - that shouldn't be a problem.

    J23


  12. On 2/8/2023 at 9:14 PM, Remy Lebeau said:

    You use the token pretty much the same way you use any other SASL credentials with TIdSMTP:

    It works, OAuth2 mail sent and received!
    On 2/8/2023 at 9:14 PM, Remy Lebeau said:

    can also be done manually with TIdHTTP

    Thank you very much Remy.
    Now maybe I'll try to get a token using IdHTTP ;-)
    Regards,
    J23

  13. On 11/23/2022 at 12:45 AM, Remy Lebeau said:

    and then you can use TIdHTTP to retrieve an access token from Google, and use TIdSASLXOAuth2 to use that token with TIdSMTP/TIdPOP3/TIdIMAP4

    Good morning again. After an unplanned break, I'm back to the problem. I tried to get the token as you advised using TIdHTTP but I don't know how to do it without REST libraries (Delphi 2010). Finally, I installed ICS (overbyte.be) and with the help of the RestOAuth component I was able to get the token. I still don't know what to do next: how to use the token, IdSASLXOAuth21 and IdSMTP to send an email.

    J23

×