필터 지우기
필터 지우기

sendmail() gives Network is unreachable error on one of my computers

조회 수: 2 (최근 30일)
Benjamin
Benjamin 2015년 7월 25일
댓글: Benjamin 2015년 8월 3일
I have two PCs both with Matlab R2014a installed. The following code:
setpref('Internet','SMTP_Server','my_smtp');
setpref('Internet','E_mail','my_email@my_email.com');
sendmail({'my_email@my_email.com'},'My subject');
works on one of my PCs but on the other one it gives an error:
Error using sendmail (line 171)
Could not connect to SMTP host: my_smpt, port: 25;
Network is unreachable: connect
of couse with my real SMPT and email address inserted.
Any suggestions? The PCs are on the same network. One is 32 bit and one is 64 bit, though...
Thanks for any inputs :)
Ben
  댓글 수: 2
Walter Roberson
Walter Roberson 2015년 7월 25일
It could be differences in the way you set up your Windows Firewall.
Benjamin
Benjamin 2015년 7월 25일
Thanks for that suggestion, Walter! I tried to check and could not find any differences. Also, I added Matlab to the list "Allow programs to communicate through Windows Firewall". Unfortunately I still get the same error...

댓글을 달려면 로그인하십시오.

채택된 답변

Udaya Mallampati
Udaya Mallampati 2015년 7월 27일
This error might be due to a Java Socket Exception, triggered by an interaction between Java 7 and an IPv4 connection. The Java Development Toolkit 7 (JDK) supports IPv6 on Windows machines. When you try to connect to an IPv4 address, JDK7 will use an IPv6 address that was mapped to an IPv4.
To remedy this issue, you would need to use a flag in the java run time. You can follow the below instructions for that:
  • Create "java.opts" file in matlabroot\bin\arch folder.
  • Write the following line in "java.opts" file:
-Djava.net.preferIPv4Stack=true
  • Restart MATLAB.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Web Services에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by