简体   繁体   中英

I always got “permission denied” when I try to send email by smtp.gmail.com on Android

I get the following exception when sending email ( by my code, not by email app ) on my android emulator - javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465; java.net.SocketException: Permission denied.

Any one can give me some help? Thanks.

This happens to me when I send SMTP mail from my laptop through my Google account, which I like to do because the Google SMTP is authenticated and lets me send from any network I'm on. Well, occasionally I get this "permission denied" thing -- notably when I'm at Carrows, and today I got it trying to send from a local ISP in Europe.

I tried switching from SMTP port to "Submission port 587" and it worked. Don't know how my mailer sorted this out, but the message was definitely sent within an SSL session, but I don't know exactly how the authentication was executed.

I believe it had something to do with port blocking by the ISP.

I'm using Eudora 7.1.0.9.

smtpd 's default listening port is 25, not 465. You must first establish what port the SMTP server is listening on.

Also, email clients usually use IMAP on port 43 to communicate with the mail server.

There is an advanced way of establishing the connection with listening port using Telnet.

If you know Telnet and are comfortable using it, I can supply the steps you should follow.

Otherwise you will have to contact the admin of the email server you are using.

The solution to my problem was:

AndroidMainfest.xml

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM