关于邮件发送
aide吧
全部回复
仅看楼主
level 11
出错在什么地方,完全找不到。。。
2016年02月16日 20点02分 1
level 11
没有访问网络的权限
2016年02月17日 00点02分 2
可以了,谢谢
2016年02月17日 04点02分
level 12
第一句,没网络权限,添加 <!--允许程序访问网络连接,可能产生GPRS流量-->
<uses-permission android:name="android.permission.INTERNET"/>
2016年02月17日 00点02分 3
可以用了,谢谢
2016年02月17日 04点02分
@城之内佳织里 源码给我
2016年02月17日 04点02分
回复
师贞盈
:啊?
2016年02月17日 04点02分
回复
师贞盈
:你要?
2016年02月17日 04点02分
level 4
楼主大神
2016年02月17日 01点02分 4
呃。。。并不是大神。。。。
2016年02月17日 04点02分
level 9
小白求源码
2016年02月17日 04点02分 5
level 11
public void send(View view){
//密码验证器
Authenticator pass_info=new Authenticator(){
@Override
protected PasswordAuthentication getPasswordAuthentication(){
return new PasswordAuthentication("用户名", "密码");
}
};
//服务器信息
Properties properties = new Properties();
properties.put("mail.smtp.auth", "true");
properties.put("mail.smtp.host", "smtp.163.com");
properties.put("mail.smtp.port", "25");
Session session=Session.getDefaultInstance(properties,pass_info);
try{
message=new MimeMessage(session);
message.setFrom(new InternetAddress("[email protected]"));//发件地址
message.setRecipient(Message.RecipientType.TO,new InternetAddress("[email protected]"));//收件地址
message.setSubject("[hi]");//主题
message.setSentDate(new Date());//发送时间
message.setText(messagE.getText().toString());//设置内容
new Thread(){
@Override
public void run()
{
try
{
Transport.send(message);
}
catch (MessagingException e){}
}
}.start();
Log.i("email","发送成功");
}catch(Exception e){
Log.e("email","发送失败");
}
}
2016年02月17日 04点02分 6
2016年02月17日 04点02分
回复 脆饼干º :这对于纯洁的我来说实在是 捂脸
2017年11月06日 05点11分
level 12
楼主知道我这为什么出错么,求助
2016年02月17日 05点02分 8
都11级了,还装逼
2016年02月17日 06点02分
改成 getBaseContext() 都11级了还装逼
2016年02月17日 08点02分
@城之内佳织里 [滑稽]等级很重要么
2016年02月18日 06点02分
level 12
你看,楼主[阴险]
2016年02月18日 06点02分 9
level 2
你好
2018年03月11日 11点03分 11
level 12
Session导入的哪个包?
2018年03月12日 23点03分 12
1