Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unigo-sender-simple

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unigo-sender-simple

  • 0.0.13
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Based on official UniGo Gem https://gitflic.ru/project/unisender/unigo-ruby but using gem faraday", "~> 2.0" to prevent conflicts

For the moment only send_email is supported from the base library

  gem 'unigo-sender-simple'
  bundle install

configuration example

    Unigo::Sender.configure do |config|
      config.host = "go1.unisender.ru"
      config.api_key = Rails.application.secrets.api_key
    end

usage

 message = {}

      message[:subject] = @subject
      message[:body] = { "html": "<h3>#{@title}</h3><div><p>#{@main_text}<br></p></div><div><p>#{@footer}</p></div>", "plaintext": @main_text } unless @template

      message[:from_email] = "from@test.ru"
      message[:from_name] = @from_name 

      if @bypass
        message[:bypass_unsubscribed] = 1
        message[:bypass_global] = 1
        message[:bypass_unavailable] = 1
        message[:skip_unsubscribe] = 1
      end
      message[:recipients] = []

      message[:template_engine] = "simple"
      message[:template_id] = @template if @template

      message[:recipients] << {
        email: "test@test.com",
        substitutions: {
          "title" => @title || "",
          "main_text" => @main_text || "",
          "link" => @link || "",
          "link_name" => @link_name || "",
          "secondary_text" => @secondary_text || "",
          "footer" => @footer || "",
        },
      }

      begin
        client = Unigo::Sender::Client.new
        client.send_email(message: message)
      rescue Faraday::Error => err
        raise err.response[:body] # raise Exception, { message: "Send error to #{@email} with subject #{@subject}" }
      end

FAQs

Package last updated on 05 Apr 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc