Has anyone successfully sent smtp email via Outlook.com?

Hi all,
I’m having a strange problem with a web app. It has a method to send a customer’s inquiry via email. It all works perfectly if using a Gmail account.
Recently my client asked to change the App to use their Outlook.com account instead of the Gmail account.

I am using SMTPSecureSocket, and have got the correct Port (587), and also ConnectionType is TLSv1.
The socket connects without error, the email is sent without error, my code always checks that messages left to send = 0 and SMTPSecureSocket.LastErrorCode is 0.
Basically, to all intents, it appears a though the email has been sent.


If I log a browser into the mail account at Outlook.com, I can see no trace of any “sent” mail, and the recipient of my App’s mail never receives any message.
If I check the Outlook.com activities log, I can see my App’s login events, and they are shown as “Successful Sign-in” - date - country location of the web server ALL appear correct.

Is this an Outlook issue, or any ideas??

You don’t say, but did the recipient receive the email?

Because the email wasn’t generated IN the Outlook.com mail web app, it won’t show up in the account’s sent mail. You might want to add a BCC: field to send a copy to the sender’s account.

Hi Tim,
No - recipients are not receiving any of these mails. No sign of them in their junk folders. (for testing purpose I set up dummy recipients which are addressed to my own email accounts).

Really weird, because I am not detecting any kind of error, but no mails appear to get sent, or received at the recipient’s end.

If I use the original Gmail account - all works fine!

I just tested it with my Xojo-created app called Bulk Email and it didn’t work, so I tried a few things and finally got it working. Here’s what I found:

Firstly, you have to use smtp.live.com as the smtp server (not smtp.outlook.com). Next you must use your whole email address as the username. Finally you must verify your account. Here’s the settings I used that worked:

Hi David,
Very many thanks for taking the time to investigate - much appreciated!

I have changed the server to smtp.live.com and my first test appeared to send without error (but still no email received at recipient).
I then closed and then re-opened the web session to my app, and now the SMTPSecureSocket MailError handler reports: 501 5.5.4 Invalid Email Address (but the address displayed looks fine!).

I have previously verified the Outlook.com account (using mobile phone text messages & code numbers etc) - but will I need to verify (or re-verify) for the live.com server, and if so can you point me in the right direction how to do?

Also, am I right in thinking the ConnectionType should be TLSv1 for the live.com server?

The email would ‘disappear’ for me (and those original email are still missing) until I verified the Outlook account. I used the MBS Curl Email plugin with the default security setting and port 587.

Testing the manual security settings, all on port 587:
TLSv1 works
SSLv2 does not work ‘Unknown SSL protocol error in connection to smtp.live.com:587
SSLv3 works

Thanks David,
Unfortunately, whatever I try, I sometimes get 501 5.5.4 error, or no error - but always no email arrives at recipient. Perhaps part of the issue might be that I am in Cyprus, my customer’s email account is in UK, and the server which hosts the web app is in Holland. Maybe when outlook.com sees logins (from the same “user”) from multiple countries it put a block on STMP sending… Oh well, back to Gmail for now!

Ahaaa!! I have found the solution to this problem!!
Firstly, David is correct - the server to use is smtp.live.com

But the “trick” that I was missing is this:-
The mailmessage.FromAddress MUST be set identical to the account Username. If it is not, live.com will end the socket connection immediately with no error.

Ah - this is one I ran into with both Gmail and Me.com previously and had totally forgotten. It’s actually a good idea to do this anyway as some spam filters will mark messages as spam if the two values are different.

Glad you got to the bottom of it.

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