发送电​​子邮件的自动编程 [英] Send auto email programmatically

查看:173
本文介绍了发送电​​子邮件的自动编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以编程方式发送电子邮件。

我尝试了以下code。

  

最终意图emailIntent =新的意图(                 android.content.Intent.ACTION_SEND);

  emailIntent.setType(纯/文);

  emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
          新的String [] {abc@gmail.com});

  emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
          电子邮件主题);

  emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
          电子邮件正文);

  startActivity(Intent.createChooser(
          emailIntent,发送邮件...));
 

但问题是,在发送电子邮件之前的应用程序打开的活动

我想直接发送电子邮件,而不开放撰写活动。这怎么可能?

解决方案

看的链接,对于你的问题的答案。

<一个href="http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-android-ap/2033124#2033124">不使用默认的Andr​​oid应用程序(内建电子邮件应用程序)

发送电子邮件在Android中使用JavaMail API

i want to send email programmatically.

i tried out the following code.

final Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND);

  emailIntent.setType("plain/text");

  emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
          new String[] { "abc@gmail.com" });

  emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
          "Email Subject");

  emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
          "Email Body");

  startActivity(Intent.createChooser(
          emailIntent, "Send mail..."));

but problem is that before sending email the application open the activity

i want to send email directly without open compose activity. how this possible?

解决方案

Look at the link, there is an answer for your question.

Sending Email in Android using JavaMail API without using the default android app(Builtin Email application)

这篇关于发送电​​子邮件的自动编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆