我正在尝试在Android中创建邮件发送应用程序.
如果我使用:
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
Run Code Online (Sandbox Code Playgroud)
这将启动内置的Android应用程序; 我正在尝试直接发送邮件,而不使用此应用程序.
我创建了一个Android项目,并在我的项目中添加了一个外部JAR(hessian-4.0.1.jar).然后我将JAR添加到构建路径并在Order和Export中将其检出.
看起来忽略了Order和Export,并且运行时缺少外部JAR中的所有类.
在使用Eclipse插件构建Android应用程序时,是否有从外部JAR正确包含所需类的技巧?我不想使用蚂蚁或Maven.
当我编译一个包含以下2个import语句的简单代码时:
import javax.mail.*
import javax.mail.internet.*
我收到以下消息:
package javax.mail does not exist
package javax.mail.internet does not exist
为什么我会收到此错误?
这是我的代码:
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
class tester {
public static void main(String args[]) {
Properties props = new Properties();
props.put("mail.smtp.com" , "smtp.gmail.com");
Session session = Session.getDefaultInstance( props , null);
String to = "me@gmail.com";
String from = "from@gmail.com";
String subject = "Testing...";
Message msg = new MimeMessage(session);
try {
msg.setFrom(new InternetAddress(from));
msg.setRecipient(Message.RecipientType.TO , new InternetAddress(to));
msg.setSubject(subject);
msg.setText("Working fine..!");
} catch(Exception exc) { …Run Code Online (Sandbox Code Playgroud)