2016-04-20 4 views
0
config.action_mailer.default_url_options = { host: 'http://localhost:3000/', port: 3000 } 

    config.action_mailer.delivery_method = :smtp 
    config.action_mailer.perform_deliveries = true 
    config.action_mailer.smtp_settings = { 
    :address    => "smtp.gmail.com", 
    :port     => 587, 
    :domain    => 'mail.google.com', 
    :user_name   => '[email protected]', 
    :password    => '[email protected]', 
    :authentication  => 'plain', 
    :enable_starttls_auto => true 
    } 

Mailer CodeE-Mail nicht gesendet und keine Fehler Schienen

class UserMailer < ActionMailer::Base 

    def abc 
    mail(to: '[email protected]', subject: 'here',from: '[email protected]') 
     mail to: '[email protected]', from: '[email protected]', subject: 'test email' 

    end 
end 


class UsersnewController < ApplicationController 
    def sendtest 
     UserMailer.abc().deliver 
     redirect_to root_path 
    end 
end 

Zeigt mir nicht Fehler und aber E-Mail sendet nicht :(

Antwort

0

Benutzer deliver_now statt deliver.

class UsersnewController < ApplicationController 
    def sendtest 
     UserMailer.abc().deliver_now 
     redirect_to root_path 
    end 
end 
Verwandte Themen