Stephen Isard wrote in
 <[email protected]>:
 |In case there is someone else in my situation, needing to connect to an 
 |institutional outlook account with s-nail, here is a recipe that works 
 |for me on ubuntu 20.04 LTS:

Thanks for this write-up, Stephen.

 |define update_access_token {
  ...
 |account oauth {
 |     set inbox=imaps://yourname%[email protected]
 |     set folder=${inbox}
 |     set user=loginname@organization #the name you log in with on their \
 |     website
 |     set from=emailname@organization # might be the same as user, or not

Really!?!  That is interesting, i added smtp-from (superceeding
smtp-hostname) to make this work on Microsoft, but it seems they
plugged it, as last week it did no longer work.

 |     set mta=submission://smtp.office365.com
 |     set smtp-use-starttls
 |     set smtp-auth=oauthbearer
 |     set imap-auth=oauthbearer
 ...
 |Now you can connect with
 |
 |s-nail -X 'call update_access_token' -A oauth
 |
 |The initial call to update_access_token uses the refresh token in your 
 |~/.s-nail-tokenfile to get an access token that s-nail treats as a 
 |password for logging in.  The settings of on-main-loop-tick and 

Why do you need this initial call?  Ah, you directly log into IMAP
and use that as your base, hmhm, we really deal bad with that.
Call it from within the account?

Yes it is a problem, on-main-loop-tick happens hm when the main
loop ticks, which it never does when only sending one mail
message.  on-compose-enter will get that thing.  Do you think it
would be a good idea to run it once in that case, too?  (For
simplicity etc.?  Document it better?)

  define mlt {
    echo MLT
  }
  account x {
    echo account x
  }
  define xx {
    echo eins
    echo zwei
    xit
  }
  set emptystart
  set on-main-loop-tick=mlt on-compose-enter=mlt

comes to

  #?0|kent:nail.git$ MAILRC=/tmp/t.c mailx -:u -Ax -Xxit
  account x
  #?0|kent:nail.git$ MAILRC=/tmp/t.c mailx -:u -Ax -Yxit
  account x
  mailx version v14.9.24.  Type `?' for help
  /var/spool/mail/steffen: 0 messages
  No more mail.
  MLT
  #?0|kent:nail.git$ </dev/null MAILRC=/tmp/t.c s-nail -:u -Ax -Smta=test 
-stest du@a
  account x
  MLT
  From steffen Mon Sep 12 15:26:03 2022
  Date: Mon, 12 Sep 2022 15:26:03 +0200
  To: du@a
  Subject: test
  User-Agent: s-nail v14.9.24-297-g9844dfc386


  #?0|kent:nail.git$ MAILRC=/tmp/t.c mailx -:u -Ax -Y 'call xx'
  account x
  mailx version v14.9.24.  Type `?' for help
  /var/spool/mail/steffen: 0 messages
  No more mail.
  MLT
  eins
  zwei

I will try this week.  I _do_ have a GMail thing and a Microsoft
thing, but i do not know whether they are still valid.  The GMail
thing is private though, it only allows access to the hundred
people i explicitily list, no?
I try to adjust the fetchmail python script to fit better with
s-nail, but OAuth is a mess.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

Reply via email to