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

Asked

Viewed 524 times

2

I have a method that sends emails in back Ground that works well, but I need to find a way that as the amount of incoming emails do not turn to spam. I’ve researched the JMS (Java Message Service) framework but couldn’t find a way to make it work and couldn’t find an example.

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

If you could show an example I’d be grateful.

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

Below is the method I use to send the email in back Ground:

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();
                }
            }

        });

1 answer

2


There is no guarantee that the e-mail will not end up in spam. It all depends on the software used on the server that will receive the email, amount of equal emails sent and several other factors.

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

According to google:

  • Messages per day - Daily send limit* - 2000 (500 for valuation accounts)

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

SOURCE:

https://support.google.com/a/answer/166852?hl=pt-BR

  • 1

    Nothingness guarantor email will not stop in spam. It all depends on the software used on the server that will receive the email, amount of equal emails sent and several other factors.

  • So the best way to solve this is to create other Gmail accounts to manage these submissions?

  • See if this helps: http://blog.mailchimp.com/chimpbot-the-api-wrapper-for-android/

  • So Lollipop, I saw and I saw but I didn’t understand. I couldn’t find a solution for JMS and SMTP . Now for example, if you want to do an email marketing, there are services that you hire and there is also such a business account, which is nothing more than an account with unlimited submissions.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.