The method that sends email works, but how to prevent the amount of incoming emails from being spam?

2

I have a method that sends email back ground that works well, but I need to make sure that as the amount of incoming email does not come from Spam. I have already researched the Java Message Service (JMS) framework but I have not found a way to make it work and I have not found an example.

The idea is to call this frame work and pass SMTP into it.

If you can show an example, I'll be grateful.

Remembering that the method works well, but if in the case an email receives more than 10 thousand emails for example, it could go to Spam. That's why I wanted to find a way for it not to happen.

Here is the method I use to send the email back:

ui.btnEnviarPedidoParaEmail.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                rec = "";
                subject = "Pedido Solicitado";
                textMessage = "Nome: " + ui.nome.getText() +
                        "<br />" + "Rua: " + ui.rua.getText() +
                        "<br />" + "Número: " + ui.numero.getText() +
                        "<br />" + "Complemento: " + ui.complemento.getText() +
                        "<br />" + "Bairro: " + ui.bairro.getText() +
                        "<br />" + "CEP: " + ui.cep.getText() +
                        "<br />" + "Telefone: " + ui.telefone1.getText() +
                        "<br />" + "Celular: " + ui.telefone2.getText() +
                        "<br />" + "Valor total do Pedido: " + CurrencyUtils.format(BigDecimal.valueOf(valorDoPedido)) +
                        "<br />" + "-------------------------------" +
                        "<br />" + "Lista de itens solicitados:" +
                        "<br />" + "Produto: " + nomeDoProduto +
                        "<br />" + "Descrição: " + descricaoDoProduto +
                        "<br />" + "Preço unitário: " + CurrencyUtils.format(BigDecimal.valueOf(precoUnitarioDoProduto)) +
                        "<br />" + "Quantidade :" + quantidadeDoProduto;


                Properties props = new Properties();

                props.put("mail.smtp.host", "smtp.gmail.com");
                props.put("mail.smtp.socketFactory.port", "465");
                props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
                props.put("mail.smtp.auth", "true");
                props.put("mail.smtp.port", "465");

                session = Session.getDefaultInstance(props, new Authenticator() {
                    @Override
                    protected PasswordAuthentication getPasswordAuthentication() {
                    return new PasswordAuthentication("", "");
                    }
                });

                pdialog = ProgressDialog.show(context, "", "Enviando o pedido para o email...", true);

                RetreiveFeedTask task = new RetreiveFeedTask();
                task.execute();

            }

            class RetreiveFeedTask extends AsyncTask<String, Void, String> {

                @Override
                protected String doInBackground(String... params) {
                    try {
                        Message message = new MimeMessage(session);
                        message.setFrom(new InternetAddress(""));
                        message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(rec));
                        message.setSubject(subject);
                        message.setContent(textMessage, "text/html; charset=utf-8");

                        Transport.send(message);
                    } catch (MessagingException e) {
                        e.printStackTrace();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    return null;
                }

                protected void onPostExecute(String result) {
                    pdialog.dismiss();

                    Toast.makeText(getApplicationContext(), "Pedido enviado com sucesso!", Toast.LENGTH_SHORT).show();
                }
            }

        });
    
asked by anonymous 19.02.2015 / 20:53

1 answer

2

Nothing guarantees that the email does not stop at Spam. It all depends on the software used on the server that will receive the email, amount of equal emails sent and various other factors.

  

Sending 10 thousand emails is a very suspicious thing for email services.   That is, before the thousand, it goes to spam DOES NOT MATTER THE CODE.

According to google:

  • Messages per day - Daily upload limit * - 2000 (500 for evaluation accounts)

  • Recipients per message (sent via SMTP, POP or IMAP Access) - Addresses in the To, Cc and Bcc fields of a single email * - LIMIT 99

SOURCE:

link

    
19.02.2015 / 21:03