Example #1
0
def SendMail(sender, msg, subject, filenmame=None):

    outlook_config_data = cs.readConfig('outlook_mail')
    emailId = outlook_config_data.get('emailId')
    password = outlook_config_data.get('emailPassword')

    if emailId == None or password == None:
        cs.warn('unable to retrive mail cred')
        cs.reConfig('outlook_mail')
        return SendMail(sender, msg, subject, filenmame)

    authenticiation = (emailId, password)
    m = Message(auth=authenticiation)
    m.setRecipients(sender)
    m.setSubject(subject)
    m.setBodyHTML(msg)
    m.setSenderName()

    if filenmame:
        att = Attachment(path=filenmame)
        m.attachments.append(att)

    mailSendStatus = m.sendMessage()

    return mailSendStatus
Example #2
0
 def send_email(email, subject, message):
     o365_auth = ('*****@*****.**', 'Notreset2017!')
     m = Message(auth=o365_auth)
     m.setRecipients(email)
     m.setSubject(subject)
     m.setBodyHTML(message)
     m.sendMessage()
     print("Email was send on {}, with message: {}".format(email, message))
Example #3
0
def email(to, subject, body, path):
    authenticiation = ('email', 'password')
    m = Message(auth=authenticiation)
    m.setRecipients(to)
    m.setSubject(subject)
    m.setBody(body)
    att = Attachment(path=path)
    m.attachments.append(att)
    m.sendMessage()
Example #4
0
def message():
    # Basic variables for authorization:
    user = "******" # For shits and giggles...
    email = '*****@*****.**'
    pwd = 'yoursupersecretpassword'
    auth = (email, pwd)
    # Message object:
    m = Message(auth=auth)
    # Recipients
    m.setRecipients('I generally create a list and pass it through here.')
    # Subject:
    m.setSubject('Automation rules')
    # Body:
    m.setBody('Good morning, {}.\n\nHAL-9000'.format(user))
    # Send:
    m.sendMessage()
Example #5
0
    def send(self, subject, body, to=None):
        """
        Envia email
        :param subject: titulo de mensagem
        :param body: corpo do email
        :return: objeto de email
        """
        m = Message(auth=(self.user, self.pwd))
        emails = self.to_email if to is None else to

        for i in emails.split(';'):
            m.addRecipient(i)
        m.setSubject(subject)
        m.setBodyHTML(body)
        try:
            m.sendMessage()
        except Exception as e:
            self.error = f'Falha ao enviar o email{e}'
Example #6
0
def message(new_user):
    # Basic variables for authorization:

    email = config.EMAIL
    pwd = config.PW
    auth = (email, pwd)
    # Message object:
    m = Message(auth=auth)
    # Recipients
    m.setRecipients(new_user)
    # Subject:
    m.setSubject('Thanks for Signing Up')
    # Body:
    user = Users.query.filter_by(email=new_user).first()
    uname = user.usname
    name = user.name
    m.setBody(
        'Hello, {}.\n\n Thanks for signing up for an account on PicShare.\n\nYour user name is: {}\n\nLogin and start sharing pictures!\n -Ava'
        .format(name, uname))
    # Send:
    m.sendMessage()
# temp: to avoid ssl error
import urllib3
urllib3.disable_warnings()

import password_list
user = password_list.user
password = password_list.password

from O365 import Message
authenticiation = (user, password)
m = Message(auth=authenticiation)
m.setRecipients(user)  ###
m.setSubject('test.')
m.setBody('test.')
m.sendMessage()