Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Mail Merge ruby gem

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 mail_merge.gemspec
README.rdoc

mail_merge

Mail Merge Gem

Parses a string and replaces specified merge fields with the evaluated result:

Usage
  • MailMerge.merge(content, options = {}, merge_fields = [], delimeter = “::”, allow_dynamic = false)

Examples
  • content = “Welcome to ::site.name::, ::user.full_name::!”

  • merged_content = MailMerge.merge(content, {:site => @site, :user => @user}, ['::site.name::', '::user.full_name::']) # Basic example

  • merged_content = MailMerge.merge(content, {:site => @site, :user => @user}) # This will evaluate any merge fields that start with 'site' or 'user'

  • merged_content = MailMerge.merge(content, {:site => @site, :user => @user}, ['~~site.name~~', '~~user.full_name~~'], “~~”) # Using your own delimeter

  • content = “Welcome, ::[user-1].full_name::!” merged_content = MailMerge.merge(:content => content, :allow_dynamic => true) # This will call find on any fields wrapped in [] (Ex. User.find(1).full_name) # output: “Welcome, Andrew Wiggin!”

Something went wrong with that request. Please try again.