
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Website: https://www.smtp.com/solutions/transactional-email-service-api/ API documentation: https://www.smtp.com/wp-content/uploads/SMTP-Transactional-API-Documentation.pdf
Ruby 1.9.3 or above
gem install smtpcom-sendapi
source 'https://rubygems.org'
gem 'smtpcom-sendapi', require: 'smtpcom/sendapi'
Setting your API key
Smtpcom::Sendapi.api_key = 'YOUR_API_KEY'
List all
Smtpcom::Sendapi::Campaign.all
Create
campaign = Smtpcom::Sendapi::Campaign.new
campaign.name = 'MyCampaign'
campaign.save
puts campaign.id
#=> 556998d4130e7f0aa881b5c1
Find
campaign = Smtpcom::Sendapi::Campaign.find('556998d4130e7f0aa881b5c1')
# you can also get some stats from campaign object
puts campaign.opens
puts campaign.clicks
puts campaign.delivered
puts campaign.bounced
Delete
campaign.delete
email = Smtpcom::Sendapi::Email.new
email.subject = 'Hello world subj'
email.from = 'from@mywebsite.com'
email.body_text = 'Hello world'
# add recipients
email.add_recipient 'john@mywebsite.com', 'John'
email.add_recipient 'linda@mywebsite.com'
# add headers
email.add_header 'X-CustomID', '81d4350b'
# add attachment
# can be attachment data in base64 format, or a url where the attachment can be downloaded from
email.add_attachment 'Image1', 'image/jpeg', base64_content
# send email
email.send
Allowed email attributes:
- subject
- body_html
- body_text
- template_id
- from
- from_name
- reply_to
- reply_to_name
- return_path
- recipients
- recipients_url
- default_recipient_data
- attachments
- campaign
- utm_codes
- email_headers
List all
Smtpcom::Sendapi::Template.all
Create
template = Smtpcom::Sendapi::Template.new
template.name = 'Template 1'
template.from = 'john@mywebsite.com'
template.from_name = 'John'
template.subject = 'Hello world'
template.html = 'HTML email body'
template.save
puts template.id
#=> 156928d1130a7f0ab781b5c2
Find
template = Smtpcom::Sendapi::Template.find '156928d1130a7f0ab781b5c2'
Delete
template.delete
List all
Smtpcom::Sendapi::Sender.all
# Parametes: time_start, time_finish, sender, campaign_id
report = Smtpcom::Sendapi::SendsReport.new time_start, time_finish
# return sends as array, accepts 2 optional parameters - count, page
report.all
# return failed sends as array, accepts 2 optional parameters - count, page
report.failed
# Parametes: time_start, time_finish, sender, campaign_id
report = Smtpcom::Sendapi::OpensReport.new time_start, time_finish
# return opens as array, accepts 2 optional parameters - count, page
report.all
# return opens as csv
report.csv
# Parametes: time_start, time_finish, sender, campaign_id, url
report = Smtpcom::Sendapi::ClicksReport.new time_start, time_finish
# return clicks as array, accepts 2 optional parameters - count, page
report.all
# return clicks as csv
report.csv
# Parametes: time_start, time_finish, sender, campaign_id, url
report = Smtpcom::Sendapi::StatsSummary.new time_start, time_finish
report.all
# in csv format
report.csv
# get real time reporting settings
Smtpcom::Sendapi::RealTimeReporting.settings
# configure real time reporting
r = new Smtpcom::Sendapi::RealTimeReporting
r.queue_name = 'MyQueue'
r.server_region = 'us-west-2'
r.public_access_key = 'public_key'
r.private_access_key = 'private_key'
r.notify_opens = false
r.notify_clicks = true
r.notify_delivert_info = false
r.save
FAQs
Unknown package
We found that smtpcom-sendapi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.