я имел проблемы при отправке почты использованияКонтактная Java это мой кодjavax.mail.SendFailedException Недействительные адреса при отправке почты
package callcentersystem;
public class Email {
private String topic = "my test";
private String myMassage = "nothinge";
public void untitledMethod(String to) {
String host = "my ip adresse";
Properties properties = System.getProperties();
properties.setProperty("mail.smtp.host", host);
Session session = Session.getDefaultInstance(properties);
try {
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(utils.Constants.From));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject(topic);
message.setText(myMassage);
Transport transport = session.getTransport("smtp");
transport.send(message);
System.out.println("Sent message successfully....");
} catch (MessagingException mex) {
System.out.println("the massage didnt send");
throw new RuntimeException(mex);
}
}
}
и это мой крах массаж
the massage didnt send
Exception in thread "main" java.lang.RuntimeException: javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 530 SMTP authentication is required.
at callcentersystem.Email.untitledMethod(Email.java:33)
at callcentersystem.CallCenterSystem.main(CallCenterSystem.java:10)
Caused by: javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 530 SMTP authentication is required.
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1446)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:736)
at javax.mail.Transport.send0(Transport.java:191)
at javax.mail.Transport.send(Transport.java:120)
at callcentersystem.Email.untitledMethod(Email.java:29)
... 1 more
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 530 SMTP authentication is required.
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1344)
... 5 more
я перепробовал все способы решить эту проблему, но она работает доцент, и я устанавливаю администратора hmailserver, и я использую его, чтобы решить мою проблему с localhost.
я получил ту же ошибку –
Но вы изменили учетные данные фактические учетные данные на сервере электронной почты, которые вы пытались отправить? – Dreamer
Я попробовал anthor код, но на этот раз моя ошибка javax.mail.AuthenticationFailedException: не удалось подключиться –