-
Notifications
You must be signed in to change notification settings - Fork 5
Deprecate Mailtrap::Mail::FromTemplate #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
8a46ffb
2ed6682
2271774
65b0250
15f1a0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,8 +46,8 @@ config.action_mailer.delivery_method = :mailtrap | |
```ruby | ||
require 'mailtrap' | ||
|
||
# create mail object | ||
mail = Mailtrap::Mail::Base.new( | ||
# Create mail object | ||
mail = Mailtrap::Mail.from_content( | ||
from: { email: '[email protected]', name: 'Mailtrap Test' }, | ||
to: [ | ||
{ email: '[email protected]' } | ||
|
@@ -57,9 +57,20 @@ mail = Mailtrap::Mail::Base.new( | |
text: "Congrats for sending test email with Mailtrap!" | ||
) | ||
|
||
# create client and send | ||
# Create client and send | ||
client = Mailtrap::Client.new(api_key: 'your-api-key') | ||
client.send(mail) | ||
|
||
# You can also pass the request parameters directly | ||
client.send( | ||
from: { email: '[email protected]', name: 'Mailtrap Test' }, | ||
to: [ | ||
{ email: '[email protected]' } | ||
], | ||
subject: 'You are awesome!', | ||
text: "Congrats for sending test email with Mailtrap!" | ||
) | ||
|
||
``` | ||
|
||
### Email Templates API | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
require 'mailtrap' | ||
|
||
# create mail object | ||
mail = Mailtrap::Mail::FromTemplate.new( | ||
# Create mail object | ||
mail = Mailtrap::Mail.from_template( | ||
from: { email: '[email protected]', name: 'Mailtrap Test' }, | ||
to: [ | ||
{ email: '[email protected]' } | ||
|
@@ -13,6 +13,18 @@ | |
} | ||
) | ||
|
||
# create client and send | ||
# Create client and send | ||
client = Mailtrap::Client.new(api_key: 'your-api-key') | ||
client.send(mail) | ||
|
||
# You can also pass the request parameters directly | ||
client.send( | ||
from: { email: '[email protected]', name: 'Mailtrap Test' }, | ||
to: [ | ||
{ email: '[email protected]' } | ||
], | ||
template_uuid: '2f45b0aa-bbed-432f-95e4-e145e1965ba2', | ||
template_variables: { | ||
'user_name' => 'John Doe' | ||
} | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
require 'mailtrap' | ||
require 'base64' | ||
|
||
mail = Mailtrap::Mail::Base.new( | ||
# You can create a mail object using one of the following: | ||
# - Mailtrap::Mail.from_content | ||
# - Mailtrap::Mail.from_template | ||
# - Mailtrap::Mail::Base.new | ||
mail = Mailtrap::Mail.from_content( | ||
from: { email: '[email protected]', name: 'Mailtrap Test' }, | ||
to: [ | ||
{ email: '[email protected]', name: 'Your name' } | ||
|
@@ -52,3 +56,13 @@ | |
# client = Mailtrap::Client.new(api_key: 'your-api-key', sandbox: true, inbox_id: 12) | ||
|
||
client.send(mail) | ||
|
||
# You can also pass the request parameters directly | ||
client.send( | ||
from: { email: '[email protected]', name: 'Mailtrap Test' }, | ||
to: [ | ||
{ email: '[email protected]', name: 'Your name' } | ||
], | ||
subject: 'You are awesome!', | ||
text: 'Congrats for sending test email with Mailtrap!' | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its ruby 🦆