2014-01-30 6 views
0

이메일 의도를 사용하지 않고 내 앱에서 이메일을 보내고 있습니다. 그러나 Gmail은 오류 배달 보고서입니다 스팸을 탐지하고 sending.Here을 방지 다음받는 사람에게안드로이드에서 이메일 보내기

배달이 영구적으로 실패 : 영구 오류의

[email protected] 

기술 정보 : 메시지 거부합니다. 더 많은 정보는 http://support.google.com/mail/bin/answer.py?answer=69585 정보를 참조하십시오.

----- 원본 메시지 -----

X-수신 : 10.68.196.164에 의해 SMTP 아이디 in4mr16083110pbc.128.1391108875462를 함께; Thu, 2014 년 1 월 30 일 11:07:55 -0800 (PST) Return-Path : 수신 : localhost ([122.166.89.61]) by mx.google.com, ESMTPSA id bz4sm19949383pbb.12.2014.01.30.11.07.53 (버전 = TLSv1 암호 = ECDHE-RSA-RC4-SHA 비트 = 128/128)에 대한 ; Thu, 2014 년 1 월 30 일 11:07:54 -0800 (PST) 날짜 : 2014 년 1 월 30 일 11시 7 분 54 초 -0800 (PST) 보낸 사람 : 의견 : "[email protected]"메시지 ID : < [email protected]> 제목 : 성도착시 MIME 버전 : 1.0 콘텐츠 유형 : text/plain; 캐릭터 세트 = US-ASCII 콘텐츠 전송 인코딩 : 7 비트

내가 이메일을 보내하려면 다음 코드를 사용하고,

private void sendMail() { 
     Session session = createSessionObject(); 

     try { 

      Message[] message=new Message[EMAIL_TITLE.length]; 






      for(int i=0;i<EMAIL_TITLE.length;i++) 

      { 

      message[i] = createMessage(EMAIL_TITLE[i], Activity_login.BranchName+" Feedback", "Customer Feedback Received for dining\n\n\n" + 
        "Customer Feedback Received for home delivery\n\n\nOrder No : "+newbill+"\nCustomer Name : "+newname+"\nCustomer Mobile : "+mobile+"\nCall center exec. "+call_cntr+"\nDelivery Boy: "+del_boy+"\nBranch : "+Activity_login.BranchName+"\nFood : "+food+" Star\nAmbiance : "+ambiance+" Star\nService :"+service+" Star\nComments : "+comments.getText().toString(), session); 

      } 



      new SendMailTask(HDActivityAdmin.this).execute(message); 






     } catch (AddressException e) { 
      e.printStackTrace(); 
     } catch (MessagingException e) { 
      e.printStackTrace(); 
     } catch (UnsupportedEncodingException e) { 
      e.printStackTrace(); 
     } 
    } 

    private Message createMessage(String email, String subject, String messageBody, Session session) throws MessagingException, UnsupportedEncodingException { 
     Message message = new MimeMessage(session); 
     message.setFrom(new InternetAddress(Activity_login.Email, "Feedback")); 
     message.addRecipient(Message.RecipientType.TO, new InternetAddress(email, email)); 
     message.setSubject(subject); 
     message.setText(messageBody); 
     return message; 
    } 

    private Session createSessionObject() { 
     Properties properties = new Properties(); 
     properties.put("mail.smtp.auth", "true"); 
     properties.put("mail.smtp.starttls.enable", "true"); 
     properties.put("mail.smtp.host", "smtp.gmail.com"); 
     properties.put("mail.smtp.port", "587"); 

     return Session.getInstance(properties, new javax.mail.Authenticator() { 
      protected PasswordAuthentication getPasswordAuthentication() { 
       return new PasswordAuthentication("[email protected]", "password"); 
      } 
     }); 
    } 


private class SendMailTask extends AsyncTask<Message, Void, Void> { 
     private ProgressDialog progressDialog; 
     private ProgressDialog dialog; 
     /** application context. */ 
     private Activity activity; 
     private Context context; 


     public SendMailTask(Activity activity) { 
      this.activity = activity; 

      context = activity; 
      dialog = new ProgressDialog(context); 
     } 


     @Override 
     protected void onPreExecute() { 
      super.onPreExecute(); 

      dialog = new ProgressDialog(context); 


      this.dialog.setMessage("Sending E-mails, Please wait..."); 
      this.dialog.show(); 



     } 

     @Override 
     protected void onPostExecute(Void aVoid) { 
      super.onPostExecute(aVoid); 


      if (dialog.isShowing()) { 
       dialog.dismiss(); 
      } 


      AlertDialog alertDialog = new AlertDialog.Builder(
        HDActivityAdmin.this).create(); 

      alertDialog 
        .setMessage(Output); 
      alertDialog.setButton("OK", 
        new DialogInterface.OnClickListener() { 
         public void onClick(DialogInterface dialog, 
           int which) { 
          // TODO Add your code for the button here. 

          finish(); 
         } 
        }); 
      alertDialog.show(); 




     } 

     @Override 
     protected Void doInBackground(Message... messages) { 
      try { 


       for(int i=0;i<messages.length;i++) 
       { 

        Transport.send(messages[i]); 

       } 




      } catch (MessagingException e) { 
       e.printStackTrace(); 
      } 
      return null; 
     } 
    } 

답변

0

스팸 탐지 당신이를 보낼 때 사용하는 코드 상관하지 않는다 메시지는 메시지의 내용에만 관심이 있습니다. 메시지가 스팸으로 보이지 않는지 확인하십시오. From 및 To 주소가 유효합니까? 귀하의 메시지는 보낸 사람 주소가 "피드백"인 것처럼 보입니다. 그게 문제 일거야.