Sending/Receiving Email from an Outlook.com Account

I’ve been successfully integrating email functionality in my desktop apps for a number of years now, BUT have never had to deal with a user using Office 365 (Outlook) and having Outlook.com as their email account. I know from my reading that using a “live” account like Outlook.com, Gmail, Hotmail, etc.) is different than working with “standard” email accounts.

https://forum.xojo.com/t/has-anyone-successfully-sent-smtp-email-via-outlook-com/17994

addresses the issue somewhat (as do a few other threads I found on the forum) but the content of the thread doesn’t help me when I apply it to my coding. I’ve read a ton of stuff on the internet about it and frankly I think I’m more confused now than ever. I know, for instance, that the SMTP Server port should be 587 (not 25 as usual), SMTP Server Address should be “smtp.live.com”, etc. and on and on but with no luck.

I tried various MBS example programs for CURL Email applications but got no love. The error message I get is “55” which tells me nothing meaningful or helpful (kError_SEND_ERROR = 55 Plugin Version: 9.8. Function: One of the error constants for the Error event. Notes: failed sending network data).

I could post the code I have used successfully for the past few years (that I tried here but wouldn’t work) but it would be difficult since the code is spread across several different methods, events and properties.

I guess the bottom line is, "Does anyone have a method they have written that successfully sends/receives emails from Office 365 (Outlook) using Outlook.com as the email account?

I’m using Xojo 2016 r1.1 with Windows 7 Professional.

Thanks in advance!
… Don

You may just have some setting wrong.
e.g. SSL true/false and TLS instead.

URL like this:

smtps://smtp.live.com
goes with TLS if you set OptionSSLVersion = 6 and OptionUseSSL = 3, port 465 by default

smtp://smtp.live.com
goes with TLS if you set OptionSSLVersion = 6 and OptionUseSSL = 3, port 25 by default. Alternative port is 587.

so the S on the protocol defines if the first packet is encrypted. with just smtp, the first contact is plain text and then after TLS discussion it starts with encryption.

if you use wrong one, it will fail…

Didn’t think it was possible, but now I’m even more lost than when I started. I’ve been studying this stuff all weekend and this morning yet again, and I’m no further ahead than when I first discovered my existing way of sending emails for the past few years doesn’t work with “live” accounts like Outlook.com, Gmail, etc.

I even entertained Chillkat (and was willing to pay the rather steep purchase price) … but after looking at it carefully, I couldn’t see where it would serve as a “drop-in” solution.

I’ve even tried a number of MBS CURL examples (e.g., Examples . CURL > Send Email > Older Examples (I figured the “Older Examples” were probably more appropriate since I’m using Xojo 2016 r1.1 which was before the new SMTPSecureSocket). in hopes that it would give me a baseline from which I could “tweak” things and get something working. I added/modified ports, addresses, anything I could change and yet still no love yet and I’m running out of things to try.

Has anyone by any chance ever had to work with send/receive emails from a “live” account like Outlook.com and come up with something that works???

I don’t have an Outlook 355 account anymore so I can’t test. The server name is outlook.office365.com and the user name is the full email address. I have a test app for IMAP at http://www.mothsoftware.com/downloads/imap.zip .

Do you like to post some code you tried?
(without password!)

Thanks so much for your consideration, Beatrix. Unfortunately, after I was finally able to download the test app zip file (got a few strange errors at first saying I couldn’t download the file), I see where it’s compiled for Mac and I’m using Windows … so, I’ll never know whether it held any hope or not. But thanks for your thoughtfulness in trying!

I’ve tried so damned many things that I have extraneous lumps of code all over the place here. It’ll take me most of the day, but let me see if I can put them back together and post them here. I’m really afraid that the code is so long that posting it won’t help … but, right now, I’m certainly willing to try.

Also, my customer has yet to turn their computer back on so I can try things. I’ve got a MS Surface PRO 6 here that I’m going to add an Outlook.com account to the Office 365 Outlook in an effort to have a test vehicle.

I’ll post whatever I can as soon as I resurrect it all.

Well, with a little direction here and a little (lot?) of hand-holding there and a bunch of emails flying back and forth over the big pond, Christian Schmitz saved the day again. We took one of the MBS stock examples (/CURL/Send Email/Send email) and made some mods and got it working. The changed code would probably be too verbose to post in this response, so anyone who has this same problem, please feel free to PM me and I’ll gladly send you the test file we developed.

For those of you who are old enough to remember the cartoon Mighty Mouse, you’ll remember his iconic saying as he flew in to the rescue … “Here I come to save the day!” … Allow me to recast that slightly …

6 Likes
Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.