相关疑难解决方法(0)

Android编程 - 发送邮件

我在Android中使用以下代码发送邮件:

 Intent emailIntent = new Intent(Intent.ACTION_SEND);
 emailIntent.setType("text/html");
 emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,sendTo );

 emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "test" );
 emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "msg" );
Run Code Online (Sandbox Code Playgroud)

当编译和运行代码时,它会询问我选择"GMail","BlueTooth"等应用程序的选项.但我希望在没有用户干预的情况下发送邮件.即使通过彩信发送也会对我有好处.有人可以建议我怎么做吗?

email android mms

6
推荐指数
1
解决办法
1万
查看次数

使用带有smtp但没有SSL的JavaMail API在android中发送电子邮件

我已经解决了这个问题,它适用于使用SSL的自己的情况

而且我也尝试过这个,它在某种程度上符合我的需要,但在我的情况下它不起作用.

我也阅读了这个主题,但仍然无法在我的代码中不使用SSL发送电子邮件.

每次我发邮件都说"例外554,拒绝邮件"

我真正需要的是使用::

mailhost:"smtpout.secureserver.net"

港口号:25

谢谢,

HAPS.

android smtp jakarta-mail

6
推荐指数
1
解决办法
8504
查看次数

使用AsyncTask发送Android电子邮件

我最近问了一个关于以下代码的问题:

使用JavaMail API在Android中发送电子邮件,而不使用默认/内置应用程序

根据上一个问题,我曾就网络错误问过这个问题:

需要帮助调试电子邮件代码

我的问题是,如何成功发送包含此Android代码的电子邮件,我将如何实现AsyncTask?我看到的每个教程都告诉我我应该这样做

extend AsyncTask {
Run Code Online (Sandbox Code Playgroud)

但是,GMailSender.java已将此定义为:

public class GMailSender extends javax.mail.Authenticator
Run Code Online (Sandbox Code Playgroud)

有人能帮助我吗?谢谢!

注意:

请不要像谁曾-1白痴ED这个问题,并公布了确切的答案作为被赋予使用JavaMail API在Android中发送电子邮件,而不使用缺省的/内置的应用程序.我无法使用那种确切的编码,因为它不再可能在Android应用程序的主线程上运行网络操作.我正在寻找一种方法来使用AsyncTask,以便在后台运行该操作.我无法找到的是怎么做

extend AsyncTask {
Run Code Online (Sandbox Code Playgroud)

没有接触

public class GMailSender extends javax.mail.Authenticator
Run Code Online (Sandbox Code Playgroud)

email debugging android asynchronous task

6
推荐指数
1
解决办法
4928
查看次数

如何在Android中以后台发送电子邮件?

对于我的应用程序,我已经检索了我的消息inbox/sent.现在我想将检索到的数据发送到我的电子邮件地址.现在可以吗?是否需要任何身份验证?此外,我试图下载身份验证文件(authentication.jar,mail.jar)但不能成功.

long currentTime = System.currentTimeMillis();
    long pastThreeHour = currentTime - (AlarmManager.INTERVAL_HOUR * 3);
    String[] selectionArgs = { "" + pastThreeHour, "" + currentTime };

    Cursor cursor = contentResolver.query(uri, null, selection, selectionArgs, "date DESC");

    if (cursor != null && cursor.getCount() > 0) {
        while (cursor.moveToNext()) {

            String number = cursor.getString(cursor.getColumnIndex("address")); // check for null
            String date = cursor.getString(cursor.getColumnIndex("date")); // convert to date its long
            String message_text = cursor.getString(cursor.getColumnIndex("body"));
            String type = cursor.getString(cursor.getColumnIndex("type")); // check type and get names

            // …
Run Code Online (Sandbox Code Playgroud)

email android

6
推荐指数
2
解决办法
2万
查看次数

如何通过Glass发送电子邮件

我正在尝试使用以下代码发送从Glass获取的图像...

Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {     
    "xyz@gmail.com" });
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "My Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "My image attached");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(imageLocation));
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
Run Code Online (Sandbox Code Playgroud)

但我得到"没有应用程序可以执行此操作".我相信Glass没有这样的意图.任何人都可以提供备用解决方案,以便我可以通过Glass发送电子邮件.

google-glass google-gdk

6
推荐指数
1
解决办法
489
查看次数

捕获用户输入并使用按钮将其直接发送到电子邮件地址

我目前正在开发一个有订单的Android应用程序.我想知道如何允许应用程序捕获用户输入的内容并使用按钮将输入直接发送到电子邮件,而无需将用户带到电子邮件应用页面.我知道我的.java类有错误,但是,我正在尝试...下面是我的xml(布局)文件和我的.java类文件.请帮帮我...谢谢!!

这是我的.xml文件(布局)

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:stretchColumns="1">
<TextView
    android:id="@+id/txtname"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Name: "
    />
<EditText
    android:id="@+id/editname"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/txtname"
    android:hint="Your name please"
    />
<TextView
    android:id="@+id/txtemail"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/editname"
    android:text="Email Address: "
    />
<EditText
    android:id="@+id/editemail"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/txtemail"
    android:hint="Enter email address here"
    />
<TextView
    android:id="@+id/txtnum"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/editemail"
    android:text="Contact Number: "
    />
<EditText
    android:id="@+id/editnum"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/txtnum"
    android:hint="Enter contact number here"
    />
<TextView
    android:id="@+id/txtadd"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/editnum"
    android:text="Mailing Address: "
    />
<EditText
    android:id="@+id/editadd"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/txtadd"
    android:hint="Enter mailing address here"
    /> …
Run Code Online (Sandbox Code Playgroud)

email android android-intent

5
推荐指数
1
解决办法
2275
查看次数

Java.lang.NoClassDefFoundError - JavaMail

我的主要活动中有一个线程,它将创建类的对象 SendMail

package Logic;

import java.util.Date;
import java.util.Properties;

import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;

import android.util.Log;

public class SendMail {

String from;
String to;
String subject;
String bodyText;
String fileName;

public SendMail(String to, String fileName, String PCN) {

    this.to = to;
    this.fileName = fileName;
    this.from = "Hello@gmail.com";
    this.bodyText = "FILE";
    this.subject = PCN;
}

public void sendMailWithAttatchment() {

    Properties properties = new …
Run Code Online (Sandbox Code Playgroud)

java android

5
推荐指数
2
解决办法
1万
查看次数

Android:如何确认电子邮件已成功发送

这是我的代码,能够成功发送电子邮件

package com.send.email;    

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends Activity {

Button send;

EditText address, subject, emailtext;
/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

send = (Button) findViewById(R.id.emailsendbutton);

address = (EditText) findViewById(R.id.emailaddress);

 subject = (EditText) findViewById(R.id.emailsubject);

 emailtext = (EditText) findViewById(R.id.emailtext);

send.setOnClickListener(new OnClickListener() {

public void onClick(View v) {

// TODO Auto-generated method stub


final …
Run Code Online (Sandbox Code Playgroud)

email android android-intent

5
推荐指数
1
解决办法
2108
查看次数

错误:Gradle:错误:包 javax.mail 不存在

如何从 javamail 获取 .jar 文件?

我正在使用 intelliJ IDEA IDE 并尝试转到项目结构 - 库 - 添加 - 位于 .jar 文件并保存。然后我去了模块并检查了导出下的框,因为我用于片段等的支持库也被检查了。

使用 JavaMail API 在 Android 中发送电子邮件中的代码没有使用默认/内置应用程序,但没有使用。

我尝试使用完整的 .jar 文件以及在提取后使用,但都因相同的错误而失败。

我在代码编辑模式下没有收到错误,只有在编译时 gradle 构建失败并显示错误,“错误(3,6):Gradle:错误:包 javax.mail 不存在。请帮忙!

我还尝试按照如何在 Android 项目中使用外部 JAR 的说明进行操作但我认为这些方向与 Eclipse IDE 有关。

edt: gradle-build:

Information:Compilation completed with 25 errors and 0 warnings in 25 sec
Information:25 errors
Information:0 warnings
Error:Gradle: Execution failed for task ':app:compileDebugJava'.
Run Code Online (Sandbox Code Playgroud)

编译失败;有关详细信息,请参阅编译器错误输出。C:\Users\Marcus\Documents\IdeaProjects\Android\TestProjects\TestMailFeature3\app\src\main\java\com\majorwit\testmailfeature3\app\GMailSender.java

Error:(3, 24) Gradle: error: package javax.activation does not …
Run Code Online (Sandbox Code Playgroud)

java android jakarta-mail intellij-idea android-gradle-plugin

5
推荐指数
1
解决办法
4266
查看次数

使用默认用户帐户以编程方式发送电子邮

我希望能够根据用户在我的应用程序的活动上按下按钮,从我的应用程序发送电子邮件.应用程序在按下按钮时需要自动发送电子邮件,即我不想向用户显示另一个电子邮件表单.电子邮件应该使用手机上的用户默认电子邮件帐户发送,而不是我硬编码到我的应用程序中的电子邮件帐户.而且我不希望将用户密钥放入我的应用程序配置中的电子邮件凭据中,我只是希望能够调用一些android api并说"将此主题和正文发送到此电子邮件地址,使用默认值用户在手机上设置的帐户".

这可能吗?如果是这样,怎么样?

email android

4
推荐指数
1
解决办法
9396
查看次数