README.md in mailtrap-1.1.1 vs README.md in mailtrap-1.2.0

- old
+ new

@@ -28,11 +28,11 @@ ```ruby require 'mailtrap' # create mail object -mail = Mailtrap::Sending::Mail.new( +mail = Mailtrap::Mail::Base.new( from: { email: 'mailtrap@example.com', name: 'Mailtrap Test' }, to: [ { email: 'your@email.com' } ], subject: 'You are awesome!', @@ -48,11 +48,11 @@ ```ruby require 'mailtrap' require 'base64' -mail = Mailtrap::Sending::Mail.new( +mail = Mailtrap::Mail::Base.new( from: { email: 'mailtrap@example.com', name: 'Mailtrap Test' }, to: [ { email: 'your@email.com', name: 'Your name' } ], cc: [ @@ -81,9 +81,31 @@ data = File.open('/path/to/image.jpg').read encoded = Base64.encode64(data).gsub(/\n/,"") mail.add_attachment(content: encoded, filename: 'image.png') +client = Mailtrap::Sending::Client.new(api_key: 'your-api-key') +client.send(mail) +``` + +### Using email template + +```ruby +require 'mailtrap' + +# create mail object +mail = Mailtrap::Mail::FromTemplate.new( + from: { email: 'mailtrap@example.com', name: 'Mailtrap Test' }, + to: [ + { email: 'your@email.com' } + ], + template_uuid: '2f45b0aa-bbed-432f-95e4-e145e1965ba2', + template_variables: { + 'user_name' => 'John Doe' + } +) + +# create client and send client = Mailtrap::Sending::Client.new(api_key: 'your-api-key') client.send(mail) ``` ### ActionMailer