
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
= EmailSender Library
EmailSender is an easy to use library to send email based on Net::SMTP. It supports the well-known encryption and authentication methods, and you can use it very easily with Gmail account.
require 'email_sender'
mailer = EmailSender.new(server: "smtp.mail.com", from: "sender@mail.com") mailer.send(to: "receiver@mail.com", subject: "Test mail", content: "This is a test mail.")
== Usage
You can specify the connection parameters to SMTP server at initialization:
mailer = EmailSender.new(server: "smtp.mail.com", from: "Sender Name sender@mail.com")
mailer = EmailSender.new(server: "smtp.mail.com", from: "Sender Name sender@mail.com", enctype: :ssl_tls, authtype: :plain, username: "user.name", password: "secret")
Easier way to using Gmail account:
mailer = EmailSender.new_gmail(username: "user.name", password: "secret") mailer = EmailSender.new_gmail(from: "user.name", password: "secret")
mailer = EmailSender.new_gmail(from: "Sender Name user.name@gmail.com", password: "secret")
mailer = EmailSender.new_gmail(from: "Sender Name sender@othermail.com", username: "user.name@company.com", password: "secret")
You can modify easily the parameters of mailer object:
mailer = EmailSender.new(server: "smtp.mail.com", from: "sender@mail.com")
mailer.renew(server: "smtp.mail.com", from: "Sender Name sender@mail.com")
mailer.renew_gmail(from: "Sender Name user.name@gmail.com", password: "secret")
Send the mail to the +:to+, +:cc+ and +:bcc+ addresses with attachment:
mailer.send(to: "Receiver Name receiver@mail.com", subject: "Test mail", content: "This is a test mail.", attachment: "/path/to/file")
The +:to+, +:cc+ and +:bcc+ keys accept an email address array so you can send the message to many receivers. And the +:attachment+ key accepts also file path array so you can attach more file:
mailer.send(to: ["Receiver Name 1 receiver1@mail.com", "Receiver Name 2 receiver2@mail.com"], cc: ["Receiver Name 3 receiver3@mail.com", "Receiver Name 4 receiver4@mail.com"], bcc: [receiver5@mail.com, "receiver6@mail.com", "receiver7@mail.com"], subject: "Test mail", content: "This is a test mail.", attachment: ["/path/to/file1", "/path/to/file2", "/path/to/file3"])
If there are not specified the +:to+, +:cc+ and +:bcc+ addresses on sending use the initialized default addresses:
mailer = EmailSender.new(server: "smtp.mail.com", from: "Sender Name user.name@gmail.com", to: "Receiver Name 1 receiver1@mail.com", cc: ["Receiver Name 2 receiver2@mail.com", "Receiver Name 3 receiver3@mail.com"])
mailer.send(subject: "Test mail", content: "This is a test mail.")
You can specify the content type which is +'text/plain'+ by default:
mailer.send(to: "Receiver Name receiver@mail.com", subject: "The Ruby programming language",
content: "",
conttype: "text/html")
The library has implemented threadsafe and support the character encoded messages.
== Installation
gem install email_sender
== Requirements
ruby1.9.1 or greater
== License
Copyright (C) 2012 Peter Bakonyi
EmailSender is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) version 3.0 as published by the Free Software Foundation.
FAQs
Unknown package
We found that email_sender 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
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.