2015-04-17 29 views
6

Grails yay eklentisi (https://grails.org/plugin/mail), yaylar güvenlik eklentisi için yapılandırmaya çalışırken sürekli olarak aşağıdaki hata iletisini alıyorum.İstemci bu gönderen olarak göndermek için izinlere sahip değil (office 365, grails)

Burada, benim yapılandırma şimdiye kadar görünüyor

 

    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]" 

Ve burada benim yığın-izidir.

 

    .......| 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 

Not: Sorun yalnızca Grails yayı güvenlik eklentisinde bulunur. = "[email protected]"

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

kullanıcı adı e-posta

cevap

6

Aynı konuyla karşılaştım. Sorun, e-postadaki "from" özniteliğini no-reply @ localhost olarak ayarlamaya çalışırken yay güvenliğinden kaynaklanıyor gibi görünüyor. Yapılandırma dosyasında

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

not aşağıdaki satırları ekleyerek Dene: [email protected] sizin office365 eposta

+0

Bu çözüm benim için çalışıyor. Teşekkür ederim. – Balkrishna

+1

ayrıca grails.plugin.springsecurity.ui.forgotPassword.emailFrom = '[email protected]' satırını da eklemelisiniz. – Aasiz

+0

Yukarıdaki 2 satırlık "springsecurity" ye ihtiyacım yoktu. Office365.com'a erişmek için sadece "grails.mail.default.from" kısmını kaçırdım. (Bu bir GMail gönderen hesabı kullanılarak gerekli değildi) –

3

kullanıcı adı e-posta bölümünden eşit olmalıdır.

+0

Maalesef bu durum böyle değil. Her iki e-postanın da aynı olduğunu biliyorum. Orijinal e-postayı değiştirirken sadece bir yazım hatası. – Balkrishna

3

elimdeki oldukça kolay e-posta gönderme, bir test GMail hesabı kullanarak, fakat kod ile çöktü Grails hata bir outlook.office365.com hesabından göndermek çalıştım:

Başarısız mesajlar: com.sun.mail.smtp.SMTPSendFailedException: 550 5.7.60 SMTP;

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

Not grails.mail.username tane aynı olmalıdır grails.mail.default.from belirtilen e-posta adresi: İstemci Ben sadece bu satırı eksikti çıkıyor Bu gönderenden

olarak göndermek için gerekli izinlere sahip değil.

İşte benim için çalışan yapılandırma. Baz örnek Eylem (2 nci baskı) kitap Grails gelen hengamesinden örnektir:

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" ] 
    } 

ve burada karşılık gelen e-posta gönderme işlevi:

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: "/"); 
}