我正在按照本教程从我的应用程序发送电子邮件。
当我尝试在我的模拟器中运行它时,它会出现错误
08-10 08:40:47.839: W/System.err(526): javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
08-10 08:40:47.849: W/System.err(526): nested exception is:
08-10 08:40:47.849: W/System.err(526): java.net.SocketException: Host is unresolved: smtp.gmail.com
08-10 08:40:47.859: W/System.err(526): at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
08-10 08:40:47.859: W/System.err(526): at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
08-1 08:40:47.859: W/System.err(526): at javax.mail.Service.connect(Service.java:310)
08-10 08:40:47.859: W/System.err(526): at javax.mail.Service.connect(Service.java:169)
08-10 08:40:47.859: W/System.err(526): at javax.mail.Service.connect(Service.java:118)
08-10 08:40:47.859: W/System.err(526): at javax.mail.Transport.send0(Transport.java:188)
08-10 08:40:47.859: W/System.err(526): at javax.mail.Transport.send(Transport.java:118)
08-10 08:40:47.859: W/System.err(526): at com.mythrii.punchclockpro.Mails.send(Mails.java:107)
08-10 08:40:47.869: W/System.err(526): at com.mythrii.punchclockpro.login$DownloadImageTask.doInBackground(login.java:277)
08-10 08:40:47.869: W/System.err(526): at com.mythrii.punchclockpro.login$DownloadImageTask.doInBackground(login.java:1)
08-10 08:40:47.869: W/System.err(526): at android.os.AsyncTask$2.call(AsyncTask.java:185)
08-10 08:40:47.869: W/System.err(526): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
08-10 08:40:47.869: W/System.err(526): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
08-10 08:40:47.869: W/System.err(526): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
08-10 08:40:47.869: W/System.err(526): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
08-10 08:40:47.869: W/System.err(526): at java.lang.Thread.run(Thread.java:1019)
08-10 08:40:47.869: W/System.err(526): Caused by: java.net.SocketException: Host is unresolved: smtp.gmail.com
08-10 08:40:47.869: W/System.err(526): at java.net.Socket.connect(Socket.java:966)
08-10 08:40:47.880: W/System.err(526): at java.net.Socket.connect(Socket.java:926)
08-10 08:40:47.880: W/System.err(526): at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:233)
08-10 08:40:47.880: W/System.err(526): at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:163)
08-10 08:40:47.880: W/System.err(526): at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1359)
08-10 08:40:47.880: W/System.err(526): ... 15 more
我也给了所有的权限。
我很想知道同一个项目在我的朋友系统中运行时没有任何错误。我的系统中是否有任何外部设置sending mails
。
有什么建议么??