rpremraj / mailR

A utility to send emails from the R programming environment
http://rpremraj.github.io/mailR/
190 stars 57 forks source link

javax.mail.AuthenticationFailedException: 535 5.7.3 Authentication unsuccessful #81

Open mtclare opened 5 years ago

mtclare commented 5 years ago

sender <- "michael.t.clare@company.com" recipients <- c("michael.t.clare@company.com") send.mail(from = sender, to = recipients, subject = "mailR example2", body = "mailR example2", smtp = list(host.name = "smtp.office365.com", port = 587, user.name = "michael.t.clare@company.com",
passwd = "fakepassword", tls=TRUE), authenticate = TRUE)

upretip commented 5 years ago

I'd recommend you checking your password. everything on your code looks fine. I'm editing your code for readibility

sender <- "michael.t.clare@company.com"
recipients <- c("michael.t.clare@company.com")
send.mail(
    from = sender,
    to = recipients,
    subject = "mailR example2",
    body = "mailR example2",
    smtp = list(
        host.name = "smtp.office365.com",
        port = 587,
        user.name = "michael.t.clare@company.com",
        passwd = "fakepassword",
        tls = TRUE
    ),
    authenticate = TRUE
)

Created on 2019-05-30 by the reprex package (v0.2.1)

mtclare commented 5 years ago

Password has been checked, trust me, I have been having this problem for months. I think they must have implemented some new server security.

upretip commented 5 years ago

Password has been checked, trust me, I have been having this problem for months. I think they must have implemented some new server security.

Sounds good! I guess the only other thing i'd ask you would be if you are using an office365 mail service for your email. If you are, then i do not know what else could be wrong.

DJ-Tommy commented 4 years ago

It was easy problem. Authenticated SMTP setting was turned off. Needs only these parameters in Java

properties.put("mail.smtp.host", "smtp.office365.com"); properties.put("mail.smtp.starttls.enable", "true"); properties.put("mail.smtp.auth", "true"); properties.put("mail.smtp.port", "587"); properties.put("mail.debug", "true");

And turn one setting on within Office365 server: Users -> Active users -> User -> Mail (Tab) -> Manage email apps -> Authenticated SMTP

Suchitainf commented 3 years ago

It was easy problem. Authenticated SMTP setting was turned off. Needs only these parameters in Java

properties.put("mail.smtp.host", "smtp.office365.com"); properties.put("mail.smtp.starttls.enable", "true"); properties.put("mail.smtp.auth", "true"); properties.put("mail.smtp.port", "587"); properties.put("mail.debug", "true");

And turn one setting on within Office365 server: Users -> Active users -> User -> Mail (Tab) -> Manage email apps -> Authenticated SMTP

I am facing the same issue. Can you please help me where should I turn the above said setting on. I am using my companies mail server and would like to send mail from one of my application.

Struggling with the same authentication exception though I have used all the properties properly. Any help would be really appreciated.

Thanks.