On 20 Jan 2008, at 16:57, Rajat Garg wrote:
>
> Hi Guys,
>
> I have created a form where a user can select from a drop down list of
> names. Based on the selection, a value is passed and appropriate email
> is looked up.
>
> Then, I call actionmailer to deliver the email.
>
> Problem is that it seems that (from log file) rhtml file is passing
> correct value to sendmail_qualitylead action, however, toEmail in the
> action is either not getting set or not getting passed appropriately
> (sql command seems to be executed as shown in log file).
>
> .rhtml file ->
> <%=form_tag :controller=>"xyz",
:action=>"sendmail_qualitylead"%>
> <table width="100%" border="0"
cellspacing="1" cellpadding="3">
> <tr>
> <td width="29%" bgcolor="#EAF4F8">Name
:</td>
> <td width="71%" bgcolor="#EAF4F8">
> <%=select(:lead, :contactID, @DropDown)%>
> </td>
> </tr>
> ......
>
> xyz_controller ->
> def sendmail_qualitylead
> body=params[:lead]
> toEmail = Contact.find_by_sql(["select email from contacts where
> id=?",body["contactID"]])
to_Email will be an instance of Contact here, but it looks like you
are expecting it to be the email address itself.
Try passting toEmail.email to deliver_quality_lead_for_flying_club
Fred>
> Notifier.deliver_quality_lead_for_flying_club(body, toEmail)
> redirect_to :action => "dosearch"
> end
>
> Notifier.rb ->
> def quality_lead_for_flying_club(body, toEmail)
> @subject = ''Quality Lead''
> @body = body
> @recipients = toEmail
> @cc = body["senderEmail"]
> @from = "supp
<support-S5xpjNk2yVFBDgjK7y7TUQ@public.gmane.org>"
> @sent_on = Time.now
> @headers = {}
> content_type("text/html")
> end
>
>
> I have spent almost a day stuck at this point :( and I will really
> appreciate any help.
>
> Thanks
>
> Rajat
> >
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---