<< | Index | >>
def notify_user(email, token, time) lnf = @session.lookandfeel config = ODDB.config mail = RMail::Message.new header = mail.header recipient = header.to = email header.from = config.mail_from header.subject = lnf.lookup(:experience_subject) args = {:token => token, :email => email, :oid => @current_experience.odba_id} url = lnf._event_url(:accept_experience, args) exp_text = [ @current_experience.title, @current_experience.description, ].join("\n") mail.body = lnf.lookup( :experience_mail_body, recipient, exp_text, url, time.strftime(lnf.lookup(:time_format_long)) ) Net::SMTP.start( config.smtp_server, config.smtp_port, config.smtp_domain, config.smtp_user, config.smtp_pass, config.smtp_authtype ) { |smtp| smtp.sendmail(mail.to_s, config.smtp_user, recipient) } recipient end
lookandfeel can lookup some keys in same time.
:experience_mail_body0 => "Hallo ", :experience_mail_body1 => "\n\n", :experience_mail_body2 => "\n\nUm diesen Erfahrungsbericht zu authentifizieren, klicken Sie bitte auf den folgenden Link:\n\n", :experience_mail_body3 => "\n\nDieser Link ist bis ", :experience_mail_body4 => " Uhr gültig.\n\nMit freundlichen Grüssen\nZeno Davatz\n+41 43 540 05 50"
mail.body = lnf.lookup( :experience_mail_body, recipient, exp_text, url, time.strftime(lnf.lookup(:time_format_long)) )