i am in dead end! i am trying to make an app to receive emails on hotmail! i created a method and i am getting an error and no email receiving..
in my method:
class Recivemail < ActiveRecord::Base
attr_accessible :content, :from, :subject
def sendmail(content,from,subject)
subject = 'subject'
recipients = "linkinpark_8884@hotmail.com"
from = 'from'
sent_on = Time.now
end
end
in config>enviroments>development.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings ={
:enable_starttls_auto => true,
:address => 'smtp.hotmail.com',
:port => 587,
:authentication => :plain,
:domain => 'localhost:3000',
:user_name => 'linkinpark_8884@hotmail.com',
:password => 'mypass'
}
in views>recivemails>show
<%=@recivemail.sendmail(@recivemail.from,@recivemail.subject,@recivemail.content)%>
everything seems to working correct except that i am not getting any email any ideas??
@recivemail.send(@recivemail.from,@recivemail.subject,@recivemail.content)
The send
method in Ruby means "send a message to this object" (as-in call the method that is named by the first parameter to send
). What you're doing here is trying call a method named by the value of @recivemail.from
to the object @recivemail
.
http://ruby-doc.org/core-1.9.3/Object.html#method-i-send
In your code, the method is named sendmail
not send
anyway.
(I would not put this into a view either, but that seems to be the least of your troubles right now.)
As for your original question about receiving emails in general, start with this article . It was written several years ago, but should give you some ideas.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.