2015-04-17 9 views
6

Otrzymuję ciągle następujący komunikat o błędzie podczas próby skonfigurowania wtyczki Grails Mail (https://grails.org/plugin/mail) dla wtyczki Grails Spring Security.Klient nie ma uprawnień do wysyłania jako ten nadawca (biuro 365, grails)

Oto moja konfiguracja wygląda tak daleko,

 

    grails { 
     mail { 
      host = "smtp.office365.com" 
      port = 587 
      username = "[email protected]" 
      password = "password" 
      props = ["mail.smtp.starttls.enable":"true", 
        "mail.smtp.port":"587"] 
     } 
    } 

    grails.mail.default.from = "[email protected]" 

I tu jest mój ślad stosu.

 

    .......| Error 2015-04-17 11:59:39,184 [http-bio-8080-exec-8] ERROR errors.GrailsExceptionResolver - MailSendException occurred when processing request: [POST] /retouch/register/forgotPassword - parameters: 
    username: customer 
    Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 550 5.7.60 SMTP; Client does not have permissions to send as this sender 
    . Stacktrace follows: 
    Message: Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 550 5.7.60 SMTP; Client does not have permissions to send as this sender 
     Line | Method 
    ->> 131 | sendMessage in grails.plugin.mail.MailMessageBuilder 
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
    |  55 | sendMail  in grails.plugin.mail.MailService 
    |  59 | sendMail . . . in  '' 
    | 156 | forgotPassword in grails.plugin.springsecurity.ui.RegisterController 
    | 198 | doFilter . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter 
    |  63 | doFilter  in grails.plugin.cache.web.filter.AbstractFilter 
    |  53 | doFilter . . . in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter 
    |  49 | doFilter  in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter 
    |  82 | doFilter . . . in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter 
    | 1145 | runWorker  in java.util.concurrent.ThreadPoolExecutor 
    | 615 | run . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker 
    ^ 745 | run   in java.lang.Thread 

Uwaga: Problem występuje tylko w wtyczce bezpieczeństwa Grails Spring.

Odpowiedz

6

Wpadłem na ten sam problem. Problem wydaje się wynikać ze względu na bezpieczeństwo wiosenne próbuje ustawić "od" atrybut w e-mailu jako brak odpowiedzi @ localhost. spróbuj dodać te linie do pliku konfiguracyjnego

grails.plugin.springsecurity.ui.register.emailFrom = '[email protected]' 
grails.plugin.springsecurity.ui.forgotPassword.emailFrom = '[email protected]' 

UWAGA: [email protected] jest Twój adres e-mail Office 365

+0

To rozwiązanie działa dla mnie. Dziękuję Ci. – Balkrishna

+1

powinieneś także dodać grails.plugin.springsecurity.ui.forgotPassword.emailFrom = '[email protected]' linia – Aasiz

+0

Nie potrzebowałem powyższych 2 linii ponownie "springsecurity". Brakowało tylko części "grails.mail.default.from", aby uzyskać dostęp do office365.com. (Uwaga: nie było to konieczne przy użyciu konta nadawcy GMail) –

3

username = "[email protected]"

grails.mail.default.from = "[email protected]"

Użytkownik Email musi równać się z e-mail.

+0

Niestety nie jest to przypadek. Wiem, że oba e-maile powinny być takie same. Oto tylko literówka podczas zmiany oryginalnej wiadomości e-mail. – Balkrishna

3

Mam Grails wysyłając e-mail dość łatwo za pomocą testowe konto Gmail, ale kod rozbił się z błąd gdy próbowałem wysłać z konta outlook.office365.com:

Nieudane komunikaty: com.sun.mail.smtp.SMTPSendFailedException: 550 5.07.60 SMTP; Klient nie ma uprawnień do wysyłania jak tego nadawcy

Okazuje się, ja tylko brakuje tej linii:

grails.mail.default.from = "[email protected]" 

zanotować adres e-mail podany w grails.mail.default.from musi odpowiadać jeden w grails.mail.username.

Oto konfiguracja, która działała dla mnie. Przykładem baza jest przykładem Hubbub z Grails książki w działaniu (2nd ed):

grails.mail.default.from = "[email protected]" 
grails { 
    mail { 
     host = "outlook.office365.com" 
     port = 587 
     username = "[email protected]" 
     password = "secret" 
     props = [ "mail.smtp.starttls.enable" : "true", 
       "mail.smtp.port"   : "587", 
       "mail.smtp.debug"   : "true" ] 
    } 

i tu jest odpowiednia funkcja wysyłania e-mail:

def email() { 
    println("Sending email.."); 
    sendMail { 
     to "[email protected]" 
     subject "[mail-test]" 
     body ("This is a test email, time: " + new Date()) 
    } 
    println(" success!!!"); 
    flash.message = "Successfully sent email" 
    redirect(uri: "/"); 
} 
Powiązane problemy