I've set up a basic website where people can also create an account.

This feature is protected against spammers by using a reCAPTCHA and an email verification system, to send a verification link to the users, so that I can verify the authenticity of the email address they've provided in the login form, which doesn't work.

Everything is fine for the first 2 mails, but then the webserver throws an Exception which basically says that the connetion to Outlook servers has been closed. In my bot's inbox there's an email (sent by Outlook itself):

Hello name, To continue sending messages, please sign in and validate your Outlook.com account.
This helps us stop automated programs from sending junk email.
Thanks for your help and patience!
The Outlook.com Team

where "sign in" is basically the link to the outlook login page (not spam, it's the true outlook page). After I've clicked on it, the mail system starts working again and it's fine for other 2-3 users, then it gets blocked again and the user doesn't receive any email.

The question is, is there any way to disable this protection and keep sending emails? If not, how can I change my email text to prevent my mail being detected as spam?

I hope there's a solution, because the dedicated machine barely runs the current softwares and honestly I don't want to fix problems on 3 different servers at the same time for such a small project.

  • Yes, My bot is sending emails through an Outlook account. I don't have my own SMTP server. The bot only sends emails and the receivers are only the new users, after they've completed the first registration step.
  • The emails contain small text, with a link to the website's verification page, for example https://myhostname.com/[email protected]&d=41my67verification2random5id41421
  • The email doesn't contain any link to ads/spam/... and doesn't even contain such a word.
  • The email content is: Per confermare la registrazione sul nostro sito, vai al seguente link: https://... which means To confirm your registration on our website, go to the following link: https://...
  • The IP is actually blacklisted only on spamsources.fabel.dk, but I don't think outlook really cares, since validating the email account unblocks the server.
  • The exception is of type OutboundSpamException and SocketException: Connection closed by remote host.
  • It's not caused by idle time.
  • Please clarify, are trying to send emails through outlook. com rather than your own SMTP server?
    – Steve
    Mar 1, 2017 at 20:43
  • 1
    I have to admit being confused by this question. I have no idea what you are trying to do.
    – closetnoc
    Mar 2, 2017 at 3:15
  • Sounds like he is using outlook.com as his SMTP server without authentication. Maybe this should be flagged as unclear...I can't believe I am banned from flags because 3 have been denied recently :o(
    – Steve
    Mar 2, 2017 at 10:21
  • Sorry for that unclear info, I've edited the post right now. The bot connects to the SMTP Outlook server required to send emails (port 587). This server interrupts the connection after some emails and then I have to log in manually (browser) into my Outlook account and follow the instructions that Outlook sent me. Mar 2, 2017 at 10:22

1 Answer 1


Firstly using port 587 isn't enough on its own. This particular error message is common when trying to send email through an SMTP server that you haven't authenticated with. Trying to authenticate with the web link is useless as you need to authenticate the SMTP session. In your SMTP settings you need to specify the server, username (which is your full outlook.com email address), your outlook.com password, and specify TLS/SSL required as yes. Once you have done this your session is authenticated with outlook.com.

Now as you don't mention if you are using a free outlook.com email address or a business paid outlook.com email address I will just add a caveat I have encountered in the past where outlook.com has chucked a fuss at sending what its filters deem to be automated emails when the account is a free account. Couldn't find any documentation on it or even any specific support from Microsoft but it seems like there may be a restriction on free email addresses on outlook.com sending automated emails which should be sent either from a paid account or another SMTP server.

  • I'm using free outlook, but I don't remember if I've set up SSL correctly. I'll check as soon as possible. If it doesn't work, I'm going to set up my own SMTP server. Mar 2, 2017 at 18:48
  • 1
    I've checked the Java Mail configuration. The SMTP config was fine, the problem is outlook itself. Since I don't want an Outlook premium account, I've bought a domain and now I'll just set up my own mail server and bye bye Outlook. Thanks for the help! I didn't know that Outlook was that strict about spam protection, I know Gmail works fine without blocking anything... Mar 3, 2017 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.