mardi 26 mai 2015

Form data not being sent in the email

Below is code that I have that I basically just mimicked. A professional web developer made the website, so im just following how they did it. But, for some reason the data does not get sent in the email. But, the email does send.

controller file

def createproject
@title = "Create Your Project"
@txtname = params[:txtname]
@txtemail = params[:txtemail]
@txtdates = params[:txtdates]
@tname = params[:tname]
@txtleader = params[:txtleader]
@txttree = params[:txttree]
@txtsolar = params[:txtsolar]
@txtwater = params[:txtwater]
@txtgoats = params[:txtgoats]
@txtkids = params[:txtkids]
@txthouse = params[:txthouse]
@txtroof = params[:txtroof]
@txtlatrine = params[:txtlatrine]
@txtbuild = params[:txtbuild]
if !@txtname.nil? && @txtname != '' 
  @isvalid = true
  @data = {
    :txtname => @txtname,
    :txtemail => @txtemail,
    :txtdates => @txtdates,
    :tname => @tname,
    :txtleader => @txtleader,
    :txttree => @txttree,
    :txtsolar => @txtsolar,
    :txtwater => @txtwater,
    :txtgoats => @txtgoats,
    :txtkids => @txtkids,
    :txthouse => @txthouse,
    :txtroof => @txtroof,
    :txtlatrine => @txtlatrine,
    :txtbuild => @txtbuild
  }
end
if @isvalid
  ContactUsMailer.createproject_mail(@data).deliver
  respond_to do |format|
    format.html {render :layout=>"homeLayout"}
  end
else
  respond_to do |format|
    format.html {render :layout=>"homeLayout"}
  end
end
end

mailer file

def createproject_mail(data)

@data = data

@txtname = @data[:txtname]
@txtemail = @data[:txtemail]
@txtdates = @data[:txtdates]
@tname = @data[:tname]
@txtleader = @data[:txtleader]
@txttree = @data[:txttree]
@txtsolar = @data[:txtsolar]
@txtwater = @data[:txtwater]
@txtgoats = @data[:txtgoats]
@txtkids = @data[:txtkids]
@txthouse = @data[:txthouse]
@txtroof = @data[:txtroof]
@txtlatrine = @data[:txtlatrine]
@txtbuild = @data[:txtbuild]

mail(:to => "jacob@fusionbible.com", :subject => "TEST", :from => "no-reply@mohhaiti.org")
end

Aucun commentaire:

Enregistrer un commentaire