Esempio n. 1
0
 def test_get_from_frambo_config(self):
     assert config.get_from_frambo_config("emails", "sender")
     assert config.get_from_frambo_config("pagure", "host")
Esempio n. 2
0
from frambo.config import get_from_frambo_config

PAGURE_HOST = get_from_frambo_config("pagure", "host")
PAGURE_PORT = get_from_frambo_config("pagure", "port")
PAGURE_URL = f"https://{PAGURE_HOST}/"


def cfg_url(repo, branch, file="bot-cfg.yml"):
    return f"{PAGURE_URL}{repo}/raw/{branch}/f/{file}"
Esempio n. 3
0
 def test_get_from_frambo_config(self):
     assert config.get_from_frambo_config('emails', 'sender')
     assert config.get_from_frambo_config('pagure', 'host')
Esempio n. 4
0
from logging import getLogger
from smtplib import SMTP
from email.mime.multipart import MIMEMultipart
from email.utils import COMMASPACE, formatdate
from email.mime.text import MIMEText

from frambo.config import get_from_frambo_config
from frambo.utils import text_from_template

SENDER = get_from_frambo_config('emails', 'sender')
SMTP_SERVER = get_from_frambo_config('emails', 'smtp_server')

logger = getLogger(__name__)


def build_email_message(template_dir, template_filename, template_data):
    """Redirect"""
    return text_from_template(template_dir, template_filename, template_data)


def send_email(text,
               receivers,
               subject,
               sender=SENDER,
               smtp_server=SMTP_SERVER):
    """
    Send an email from SENDER_EMAIL to all provided receivers
    :param text: string, body of email
    :param receivers: list, email receivers
    :param subject: string, email subject
    :param sender: string, sender email
Esempio n. 5
0
from logging import getLogger
from smtplib import SMTP
from email.mime.multipart import MIMEMultipart
from email.utils import COMMASPACE, formatdate
from email.mime.text import MIMEText

from frambo.config import get_from_frambo_config
from frambo.utils import text_from_template

SENDER = get_from_frambo_config("emails", "sender")
SMTP_SERVER = get_from_frambo_config("emails", "smtp_server")

logger = getLogger(__name__)


def build_email_message(template_dir, template_filename, template_data):
    """Redirect"""
    return text_from_template(template_dir, template_filename, template_data)


def send_email(text,
               receivers,
               subject,
               sender=SENDER,
               smtp_server=SMTP_SERVER):
    """
    Send an email from SENDER_EMAIL to all provided receivers
    :param text: string, body of email
    :param receivers: list, email receivers
    :param subject: string, email subject
    :param sender: string, sender email