-1

Kindly, I have the mentioned error for this code when running on Wifi while it works when using phone 3G hotspot:

username='XXX@hotmail.com';
pass='XXXXX';
port='587';   % hotmail
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.starttls.enable', 'true' );
props.setProperty('mail.smtp.auth','true');
props.setProperty('mail.smtp.socketFactory.port',port);
setpref('Internet','SMTP_Server','smtp.live.com');
setpref('Internet','E_mail',username);
setpref('Internet','SMTP_Username',username);
setpref('Internet','SMTP_Password',pass);
sendmail(username,'Available');

Error:

Error using sendmail (line 171)

Could not connect to SMTP host: smtp.live.com, port: 25;

Connection timed out: connect

Should I change anything in the router settings?

enter image description here

  • Wasn't live.com renamed to outlook.com? – Daniel Feb 15 '16 at 17:57
  • Have no idea but outlook instead of live is not working also on Wifi. – Aboalseoud Feb 15 '16 at 18:03
  • Did you check the help section for the right server? When I try it for my Microsoft account I get redirected to [this page](http://windows.microsoft.com/de-de/windows/outlook/send-receive-from-app#) – Daniel Feb 15 '16 at 18:06
  • I found now in the help "The sendmail function does not support email servers that require authentication." – Aboalseoud Feb 15 '16 at 18:31
  • Should I change anything in the router settings? i.stack.imgur.com/Ft2Ur.png – Aboalseoud Feb 16 '16 at 17:30
  • It seems to be more a general computer problem than a programming question. I recommend to grab a mail client like Thunderbird and test it. If you experience the same problem describe it at [superuser](https://superuser.com/). Once you have verified your network infrastructure is okay, continue with your code. – Daniel Feb 16 '16 at 17:35

1 Answers1

0

You might have port 25 blocked. Try this:

telnet smtp.live.com 25

and copy results here.

Port 25 is often blocked by ISP to prevent spamming.

If you use Windows OS, you may have telnet client switched off in your system, so you are not able to use it in your command window (cmd). Go to Control Panel -> Programs and Features -> Turn Windows Features on or off and check Telnet Client.

KP13
  • 58
  • 1
  • 8
  • Connecting To smtp.live.com...Could not open connection to the host, on port 25: Connect failed – Aboalseoud Feb 16 '16 at 16:13
  • Ok. Your port 25 is blocked probably. You can also check if a specific port is open or closed at canyouseeme.org website. Did you use the same computer with Matlab with wifi and 3G hotspot? – KP13 Feb 16 '16 at 16:44
  • Yes, same computer :) – Aboalseoud Feb 16 '16 at 16:45
  • From mentioned website: Error: I could not see your service on XX.XXX.XXX.XXX on port (25) – Aboalseoud Feb 16 '16 at 16:47
  • Should I change anything in the router settings? http://i.stack.imgur.com/Ft2Ur.png – Aboalseoud Feb 16 '16 at 17:11
  • So, the port may be blocked by your router or by your ISP (what is more likely). What router do you use? And who is your ISP? – KP13 Feb 17 '16 at 14:06