0

I'm trying to send an E-Mail using Java (Java 10), but i have this error:

javax.mail.SendFailedException: No recipient addresses
at javax.mail.Transport.send0(Transport.java:154)
at javax.mail.Transport.send(Transport.java:124)
at Mail.mandaMail(Mail.java:282)
at View$1.actionPerformed(View.java:68)
[...]
Process finished with exit code 0

This is the code of the class throwing error at line "282"

variables i use:

mittente = "***************@******.com"

password = ******

host = mail.mydomain.com

destinatario = ******@gmail.com

I'm using a Aruba mail server but i don't think the configuration for it is wrong

public void mandaMail(String destinatario) throws MessagingException, NoClassDefFoundError {

    //Get the session object
    Properties props = new Properties();
    props.put("mail.smtp.host",host);
    props.put("mail.smtp.auth", true);
    Session session = Session.getDefaultInstance(props,
            new javax.mail.Authenticator() {
                protected PasswordAuthentication getPasswordAuthentication() {
                    return new PasswordAuthentication(mittente,password);
                }
            });

    //Compose the message
        Message message = new Message(session)(**Overriding all the methods*)

        message.setFrom(new InternetAddress(mittente));
        //A:
        message.addRecipient(Message.RecipientType.TO,new InternetAddress(destinatario, true));
        //CC
        message.addRecipient(Message.RecipientType.CC, new InternetAddress());
        message.setSubject("PFSistemi -"+intervento.toString());
        message.setText(this.contenuto.toString());

        //send the message
        Transport.send(message);

        System.out.println("message sent successfully...");

}

Maybe this problem is caused by overriding all the method of the Message class, i use this class because the class MimeMessage give me a tons of problems that nobody can resolve (LOL)

Vik Pelgrins
  • 26
  • 1
  • 5
  • 2
    _"Maybe this problem is caused by overriding all the method of the Message class"_ - That is most certainly the case. We would need to see your implementation of the `Message` class. – Sean Bright Sep 28 '18 at 14:17
  • Yes, it's definitely that. So can you help me with the same problem but caused by another thing? [link](https://stackoverflow.com/questions/52515171/java-mail-cant-found-the-class-mimemessage) – Vik Pelgrins Sep 28 '18 at 14:21
  • 1
    _" MimeMessage give me a tons of problems that nobody can resolve (LOL)"_, you must be doing something wrong then... – Mark Rotteveel Sep 28 '18 at 15:57
  • I answered your original question in your previous post. – Bill Shannon Oct 03 '18 at 21:19

0 Answers0