以编程方式发送自动电子邮件 [英] Send auto email programmatically

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

问题描述

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



我尝试了以下代码。


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

  emailIntent。的setType( 普通/文本); 

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

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

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

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


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





我想直接发送电子邮件,无需开放的撰写活动。

解决方案

查看链接,您的问题有一个答案。



< 2033124#2033124>使用JavaMail API在Android中发送电子邮件,而不使用默认/内置应用


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/built-in app

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

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