无法通过 SMTP yandex 错误 553 发送邮件
Can not send mail via SMTP yandex error 553
正在设置通过 smtp 发送邮件。
private String mailhost = "smtp.yandex.ru";
private String user;
private String password;
private Session session;
public static final String TAG = "GMailSender: ";
static {
Security.addProvider(new JSSEProvider());
}
public GMailSender(String user, String password) {
this.user = user;
this.password = password;
Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", mailhost);
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.ssl.enable", "true");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
props.setProperty("mail.smtp.quitwait", "false");
session = Session.getDefaultInstance(props, this);
}
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(user, password);
}
我按照这个说明做的https://yandex.ru/support/mail/mail-clients/others.html。来自应用程序密码的密码。但我收到错误发送邮件 com.太阳。邮件。 SMTP。 SMTPSendFailedException:553 5.7.1 发件人地址被拒绝:不属于授权用户。
重述错误消息:
The user
you log in with is not authorized to send email on behalf of the email address listed in the from
field of the email (the sender).
这种安全措施用于防止您冒充他人发送垃圾邮件。
我认为 yandex 方面存在错误。我也无法通过 SMTP 发送电子邮件。
正在设置通过 smtp 发送邮件。
private String mailhost = "smtp.yandex.ru";
private String user;
private String password;
private Session session;
public static final String TAG = "GMailSender: ";
static {
Security.addProvider(new JSSEProvider());
}
public GMailSender(String user, String password) {
this.user = user;
this.password = password;
Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", mailhost);
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.ssl.enable", "true");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
props.setProperty("mail.smtp.quitwait", "false");
session = Session.getDefaultInstance(props, this);
}
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(user, password);
}
我按照这个说明做的https://yandex.ru/support/mail/mail-clients/others.html。来自应用程序密码的密码。但我收到错误发送邮件 com.太阳。邮件。 SMTP。 SMTPSendFailedException:553 5.7.1 发件人地址被拒绝:不属于授权用户。
重述错误消息:
The
user
you log in with is not authorized to send email on behalf of the email address listed in thefrom
field of the email (the sender).
这种安全措施用于防止您冒充他人发送垃圾邮件。
我认为 yandex 方面存在错误。我也无法通过 SMTP 发送电子邮件。