Skip to content

RobotnikAutomation/robotnik_email

Repository files navigation

robotnik_email

The robotnik_email package, email server to send messages through ROS

Installation

This package depens on the following packages:

git clone https://github.com/RobotnikAutomation/robotnik_msgs
git clone https://github.com/RobotnikAutomation/rcomponent

Install the package:

git clone https://github.com/RobotnikAutomation/robotnik_email.git

Install other ros dependencies:

rosdep install --from-path src --ignore-src -y -r

Build the package

catkin build
source devel/setup.bash

SMTP Configuration

In order to use this package a SMTP server is required. There are two modes of use:

  • Working with a SMTP provided by a third party. For example, a customer or a company.

  • Working with your own SMTP, for testing purposes only.

a) SMTP Third Party

The customer has to give us acces to work with his SMTP. You have ask for user, password, from email, SMTP server and port. In this example credentials are not needed:

User: ---
Password: --- 
From email:  [email protected]
SMTP server: 10.100.100.10
Port: 25

b) SMTP on your own

This is the recommended way to familiarize yourself with this package.

Use a google account without double verification and watch this video to configure your own SMTP: https://www.youtube.com/watch?v=ql5Dex4m40w

At the end of the video you will be able to fill all the fields. This is an example:

User: [email protected]
Password: yourpassword 
From email:  [email protected]
SMTP server: smtp.gmail.com
Port: 587

Additionally, you can test if your SMTP server is working properly by sending an email through the following link. Select Tls as securty field: https://www.gmass.co/smtp-test

Package configuration

This package needs the SMTP server information to send emails. So that, edit the following file:

config/smtp_config.yaml

Fill the fields with your SMTP configuration like in this example:

smtp:
  server: 'smtp.gmail.com'
  port: 587
  use_authentication: true
  username: '[email protected]'
  password: 'yourpassword'
  sender: '[email protected]'
  default_recipients:
    - '[email protected]'
    - '[email protected]'

The following table describes each parameter:

Name Type Default Description
server string smtp.gmail.com Server address
port int 587 Server port
use_authentication bool False Some SMTP servers needs credentials
username string username Name credentials
password string password Password credentials
sender string [email protected] Email from where the message is sent
default_recipients string[] [email protected] If the recipients field is empty, gets these recipients
time_between_emails int 0 Time between one email and another to avoid overloads (not implemented yet)

Bringup

Launch the package:

roslaunch robotnik_email email.launch

Send a email to the default recipieints:

rosservice call /robotnik_email/send_email "recipients: []
status: {id: 0, description: '', type: '', message: ''}
uuid: ''
datetime: ''
files_to_upload: []"

Send a email to specific recipieints:

rosservice call /robotnik_email/send_email "recipients: ['[email protected]', '[email protected]']
status: {id: 0, description: '', type: '', message: ''}
uuid: ''
datetime: ''
files_to_upload: []"

Send a email to specific recipieints including some file attachments:

rosservice call /robotnik_email/send_email "recipients: ['[email protected]', '[email protected]']
status: {id: 0, description: '', type: '', message: ''}
uuid: ''
datetime: ''
files_to_upload: ['image1.png', 'video1.mkv']"

1. smtp_manager

It sends emails using a SMTP server

1.1 Parameters

  • server (string, default: smtp.gmail.com):

    SMTP server address

  • port (int, default: 587):

    SMTP server port

  • sender (string, default: ):

    Email from where the message is sent

  • use_authentication (bool, default: False):

    Enable credentials when a SMTP needs them

  • ssl (bool, default: False):

    Enable SSL connection

  • tls (bool, default: False):

    Enable TLS connection

  • timeout (int, default: 10):

    Timeout to connect to the SMTP server

  • tls (bool, default: False):

    Enable TLS connection

  • username (string, default: username):

    Name credentials

  • password (string, default: password):

    Password credentials

  • default_recipients (string[], default: []):

    Default recipiens if the recipients field is empty when a message is sent.

  • time_between_emails (int, default: 0):(NOT_IMPLEMENTED_YET)

    Time between one email and another to avoid overloads

  • include_detailed_info (bool, default: True.):

    Include detailed information in the email. The detailed information is taken from the rosservice send_email

  • auto_generate_uuid_datetime (bool, default: True):

    Automatically generate the uuid and datetime fields in the email in case it is not provided by the user

1.2 Published Topics

  • ~/state (robotnik_msgs/State): Node health

1.3 Services

  • ~/send_email (robotnik_alarms_msgs/SendAlarms) The service sends an email to the recipients with the status message and the files to upload.
    Example:
      rosservice call /smtp_manager/send_email "recipients: ['[email protected]']
      status: {id: 0, description: 'Temperature Alarm', type: '', message: 'The alarm temperature has been reached'}
      uuid: ''
      datetime: ''
      files_to_upload: ['/home/robot/Pictures/camera-1.png', '/home/robot/Pictures/camera-2.png']" 
    

About

Email server to send emails through ROS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published