Ruby on Rails
Saturday, July 22, 2017
I am working on Action mailer, email is sent successfully but incoming email not receiving.Below the code which i try
-- user_mailer.rb
class UserMailer < ApplicationMailerdefault from: "GMAIL_ACCOUNT"def send_mail_agent(user)@user = usermail :to => user.email, :subject => "your ticket in process"enddef receive(email)page = Page.find_by(address: email.to.first)page.emails.create(subject: email.subject,body: email.body)if email.has_attachments?email.attachments.each do |attachment|page.attachments.create({file: attachment,description: email.subject})endendendend
development.rb
ActionMailer::Base.smtp_settings = {
address: 'smtp.gmail.com', # default: localhost
port: '25', # default: 25
user_name: 'GAMIL_ACCOUNT',
password: 'GMAIL_PASSWORD',
authentication: :plain # :plain, :login or :cram_md5
}
I tried to run the command rails runner 'UserMailer.receive(STDIN.read)'
But nothing happened even the email is incoming .It does not call the receive method
Where should i call the receive method ??? How determine the incoming email ???
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/715f866f-2a6f-4551-ba1c-4be953c3ecf7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment