Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void sendVerificationEmail(final RegistrationRequestEntity entity, final String UID, @Nullable final boolean isSpecial) {
- AsyncTask.execute(new Runnable() {
- @Override
- public void run() {
- final String username = "robot@art-coral.com";
- final String password = "0Z8c1S3b";
- Properties props = new Properties();
- props.put("mail.smtp.auth", "true");
- props.put("mail.smtp.starttls.enable", "false");
- props.put("mail.smtp.host", "mail.art-coral.com");
- props.put("mail.smtp.port", "25");
- Session session = Session.getInstance(props,
- new javax.mail.Authenticator() {
- protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(username, password);
- }
- });
- try {
- Message message = new MimeMessage(session);
- message.setFrom(new InternetAddress("robot@art-coral.com"));
- message.setRecipients(Message.RecipientType.TO,
- InternetAddress.parse(entity.getMail()));
- message.setSubject(getString(R.string.message_email_title));
- message.setText(
- getString(R.string.message_email_message_1) + "\n\n" +
- getString(R.string.message_email_message_2) +
- "\n\n\n" +
- getString(R.string.message_email_url) +
- buildEncodedData(entity, UID, isSpecial) +
- "\n\n\n" +
- getString(R.string.message_email_message_3) + "\n\n" +
- getString(R.string.registration_email_hint) + ": " + entity.getMail() + "\n" +
- getString(R.string.registration_password_hint) + ": " + entity.getPass() +
- "\n\n\n" +
- getString(R.string.message_email_message_4)
- );
- Transport.send(message);
- } catch (MessagingException e) {
- throw new RuntimeException(e);
- }
- }
- });
- notifyUser();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement