rubyonrailsin

A Ruby and Rails talk

Friday, March 12, 2010


[Rails] Re: Email section

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

class EmailController < ApplicationController

include ProfileHelper
before_filter :protect, :only => [ "correspond" ]

def remind
@title = "Mail me my login information"
if param_posted?(:user)
email = params[:user][:email]
user = User.find_by_email(email)
if user
UserMailer.deliver_reminder(user)
flash[:notice] = "Login information was sent."
redirect_to :action => "index", :controller => "site"
else
flash[:notice] = "There is no user with that email address."
end
end
end

def email_sent

MyMailer::deliver_mail("recipient.address@example.com")

end

def correspond
user = User.find(session[:user_id])

id=session[:user_id]
Personal.find_each do |@per|
if(@per.user_id == id) # id is user id
@per_id = "#{@per.id}" #que_id is question_id
break
end
end
idd=@per_id
#flash[:notice] = idd
iddd=idd.to_i


recipient = User.find_by_user_name(params[:id])

@title = "Email: #{@per.first_name} #{@per.last_name}
(#{user.user_name}) :: Recipient: #{recipient.user_name}"
if param_posted?(:message)
@message = Message.new(params[:message])
if @message.valid?
UserMailer.deliver_message(
:user => user,
:recipient => recipient,
:message => @message,
:user_url => profile_for(user),
:reply_url => url_for(:action => "correspond",
:id => user.user_name)
)
flash[:notice] = "Email sent."
redirect_to profile_for(recipient)
end
end
end

end


ya diz is the code for email_controller....
Can u please tell me what is the problem that the email is not being
sent?
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive