fitnat wrote:> Hi,
> I want to receive emails with actionmailer.And I try to do this example:
> http://wiki.rubyonrails.org/rails/pages/HowToReceiveEmailsWithActionMailer
> I am working on windows and I couldn''t set up Actionmailer for
windows.
> How can I configure actionmailer for windows? I am glad,if anybody can
> help me
> Regards...
You need some sort of process/script that will receive the emails and
then you call the receive method on the actionmailer class. If you
google, you will find examples. However, here is a simple script that
you can use and start with the windows scheduler if necessary (or
backgrounDrb).
Regards,
Michael
#Very basic script to receive email from pop3 server
require ''net/pop''
require File.dirname(__FILE__) + ''/../config/environment''
logger = RAILS_DEFAULT_LOGGER
logger.info "Running Mail Importer..."
Net::POP3.start("mail.yourmailserver.com", nil,
"emailaccount-HlKOwzbrASxZAIG4hdpdiNBPR1lH4CV8@public.gmane.org",
"yourpassword") do |pop|
if pop.mails.empty?
logger.info "No mail!"
else
pop.mails.each do |email|
begin
logger.info "Receiving email..."
#If you want to save it before processing
tmpFileName = File.dirname(__FILE__) +
"/yourdir/#{email.unique_id}.eml"
File.open(tmpFileName, "w") { |f| f.write(email.pop) }
LeadMailer.receive(email.pop)
email.delete
rescue Exception => e
logger.error "Error receiving email at " + Time.now.to_s +
"::: " +
e.message
end
end
end
end
logger.info "Finished Mail Importer..."
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---