0

I want to send emails with javamail-android but I'am using a host server different than usual ones (Gmail, Yahoo, Hotmail, etc). The host is accessed via APN throught the mobile data network, I don't know how configure this. Currently my code for sending email setup all fields like this:

    mailer.setFrom("myself@xxxxx.com");
    mailer.setUser("myself@xxxxx.com");
    mailer.setPassword("xxxxxxxxxx");
    mailer.setHost("smtp.xxxxx.xx");
    mailer.setPort(25);
    mailer.setSocketFactoryPort(25); // ?  

I'm getting the next error Unknown SMTP host: smtp.xxxxx.xx. I know for sure that at least the above data is OK. But I don't know how to use the previous configuration on APN and "mobile-data". Is there something wrong with this configuration ? Do I have to change something to make it work with APN and mobile data network?

My code for sending email is almost the same described here.

lcastillov
  • 2,163
  • 1
  • 11
  • 17
  • BTW, you might want to switch to the official [JavaMail for Android](https://java.net/projects/javamail/pages/Home#JavaMail_for_Android). Accessing a different mail server should be just a matter of setting the properties that are appropriate for that server. Of course, you need to know what those properties **are**, but the owner of the server should tell you that - host name, port number, SSL or not, etc. – Bill Shannon Oct 01 '15 at 21:38
  • But, there are any way to setup APN while sending email with javamail ? I'ts necesary to do it ? There is not access to the server via wifi . – lcastillov Oct 01 '15 at 21:50
  • 1
    Setting up APN and sending email are completely independent operations. I don't know if or how a program can set up APN. Normally it's set up when a mobile device is configured for the mobile network and doesn't need to change. Once set up, it should provide TCP/IP access for all applications, including those using JavaMail. The TCP/IP stack will choose whether to use wifi or mobile data depending on what's available. – Bill Shannon Oct 01 '15 at 22:40

0 Answers0