# -*- encoding : utf-8 -*-
class General < ActionMailer::Base
  default :from => "lamaisondelarbre@wanadoo.fr"
  self.default_url_options = {:host => HOSTNAME}

  # Subject can be set in your I18n file at config/locales/en.yml
  # with the following lookup:
  #
  #   en.general.send_newsletter.subject
  #
  def send_newsletter(email,newsletter, inscrit=nil)
    @newsletter = newsletter
    @inscrit = inscrit if inscrit
    
    mail(:to => email, :subject => @newsletter.subject) do |format|
        format.html { render :action => "send_newsletter"}
      end
  end
  
  def confirm_inscription(inscrit)
    @inscrit = inscrit
    mail(:to => inscrit.email, :subject => "Validation de votre inscription à la newsletter de la maison de l'arbre.") do |format|
        format.html { render :action => "confirm_inscription"}
      end
  end
  
  def valide_inscription(inscrit)
    @inscrit = inscrit
    mail(:to => inscrit.email, :subject => "Votre inscription à la newsletter de la maison de l'arbre.") do |format|
        format.html { render :action => "valide_inscription"}
      end
  end
  
  def destroy_inscription(inscrit)
    @inscrit = inscrit
    mail(:to => inscrit.email, :subject => "Votre inscription à la newsletter de la maison de l'arbre.") do |format|
        format.html { render :action => "destroy_inscription"}
      end
  end
end
