Пример #1
0
def sendEMail(texto, jornada):
    """
        Sends the email to the selected mailing list
    """
    envelope = Envelope(
        from_addr=("*****@*****.**", "Tasco BOT"),
        to_addr=[
            ("*****@*****.**", "Filipe"),
            # ("*****@*****.**", "Capela"),
        ],
        subject=f"Misters do Tasco - Resultados da {jornada}",
        html_body=texto,
    )
    gmail = GMailSMTP("*****@*****.**", "ketooketyr")
    gmail.send(envelope)
Пример #2
0
def send_mail(username, password, from_email, from_name,
                to_addresses, subject, body_template, config_path):
    gmail = GMailSMTP(username, password)
    for to_email, to_name in to_addresses:
        properties = parse_config(config_path, to_email)
        body = body_template.render(**properties)
        envelope = Envelope(
            from_addr=(from_email, from_name),
            to_addr=(to_email, to_name),
            subject=subject,
            text_body=body
        )

        logger.info(str(envelope))
        if not publicity_do_not_send:
            gmail.send(envelope)
Пример #3
0
def send_mail(subject, content, to_addr=EMAIL_DESTINATION, gmail_addr=GMAIL_ADDR, gmail_password=GMAIL_PASSWORD):
    """
    Sends an email.
    :param subject: The subject of the email.
    :param content: The content of the email.
    :param to_addr: The address to send the email to.
    :param gmail_addr: The address to sell the email from (must be gmail).
    :param gmail_password: The password to the gmail account.
    """
    envelope = Envelope(
        from_addr=gmail_addr,
        to_addr=to_addr,
        subject=subject,
        text_body=content
    )

    gmail = GMailSMTP(gmail_addr, gmail_password)
    gmail.send(envelope)
Пример #4
0
    def send_mails(self):
        recepient_list_not_send = list(filter(lambda x: x[3] is False, self._get_recepient_from_xls_file()))

        if not recepient_list_not_send:
            return

        for recepient in recepient_list_not_send:
            text_body = f'''
                Dear client {recepient[0]},
                ````My text````
                
                Best regards, My Name.
                '''
            try:
                envelope = Envelope(
                    from_addr='My Name',
                    to_addr=recepient[1],
                    subject='My Subject',
                    text_body=text_body)
                envelope.add_attachment(self.attach_file_path)
                gmail = GMailSMTP(login=self.email_address, password=self.password)
                gmail.send(envelope)

                rb = xlrd.open_workbook(self.recepient_xls_path)
                wb = copy(rb)
                s = wb.get_sheet(recepient[4])
                s.write(recepient[5], 15, 1)
                wb.save(self.recepient_xls_path)
                sleep(5)

            except Exception:
                rb = xlrd.open_workbook(self.recepient_xls_path)
                wb = copy(rb)
                s = wb.get_sheet(recepient[4])
                s.write(recepient[5], 15, 0)
                wb.save(self.recepient_xls_path)
                continue
Пример #5
0
def send_envelope(to, cc, bcc, subject, message, reply_to=None, attach=None):

    _et = os.path.join(templates_folder, 'email.html')
    ET = Template(filename=_et)
    M = ET.render(message=message, subject=subject)
    if not reply_to:
        reply_to = '*****@*****.**'
    envelope = Envelope(from_addr=(u'*****@*****.**',
                                   u'Fearless Notifications'),
                        to_addr=to,
                        cc_addr=cc,
                        bcc_addr=bcc,
                        subject=subject,
                        html_body=M,
                        headers={'Reply-To': reply_to})
    #envelope.add_attachment('/home/farsheed/Desktop/guntt.html', mimetype="text/html")

    if attach and os.path.isfile(attach):
        envelope.add_attachment(attach)

    pwd = '\n=MnbvlGdjVmalJlcvZUekFWZSVmY'[::-1]

    gmail = GMailSMTP('*****@*****.**', base64.decodestring(pwd))
    gmail.send(envelope)
Пример #6
0
    def __send_mail(self, envelope: Envelope, gmail: bool):
        account = self.account
        port = self.port
        smtp = self.smtp
        username = self.username
        password = self.password
        try:
            if not gmail:
                response = envelope.send(smtp,
                                         login=username,
                                         port=port,
                                         password=password,
                                         tls=True)
            else:
                gmail = GMailSMTP(account, password)
                response = gmail.send(envelope)

        except Exception as e:
            raise EmailException(e)
        return response
Пример #7
0
# coding=utf-8
from envelopes import Envelope, GMailSMTP

envelope = Envelope(from_addr=(u'*****@*****.**', u'From Example'),
                    to_addr=(u'*****@*****.**', u'To Example'),
                    subject=u'Envelopes demo',
                    text_body=u"I'm a helicopter!")
envelope.add_attachment('/Users/bilbo/Pictures/helicopter.jpg')

# Send the envelope using an ad-hoc connection...
envelope.send('smtp.googlemail.com',
              login='******',
              password='******',
              tls=True)

# Or send the envelope using a shared GMail connection...
gmail = GMailSMTP('*****@*****.**', 'password')
gmail.send(envelope)
Пример #8
0
# coding=utf-8
from envelopes import Envelope, GMailSMTP

envelope = Envelope(
    from_addr=(u'*****@*****.**', u'From Example'),
    to_addr=(u'*****@*****.**', u'To Example'),
    subject=u'Envelopes demo',
    text_body=u"I'm a helicopter!"
)
envelope.add_attachment('/Users/bilbo/Pictures/helicopter.jpg')

# Send the envelope using an ad-hoc connection...
envelope.send('smtp.googlemail.com', login='******',
              password='******', tls=True)

# Or send the envelope using a shared GMail connection...
gmail = GMailSMTP('*****@*****.**', 'password')
gmail.send(envelope)
Пример #9
0
from envelopes import GMailSMTP

gmail = GMailSMTP('*****@*****.**', '314promtal.ua')
Пример #10
0
from configparser import ConfigParser
import logging

logging.basicConfig(format='%(asctime)s[%(levelname)s] %(message)s',
                    level=logging.DEBUG,
                    datefmt='%Y-%m-%d %H:%M:%S')

cfgfile = "gmail.ini"
cfg = ConfigParser()
cfg.read(cfgfile)

#The mail addresses and password
sender_address = cfg.get('GMAIL', 'GUSER')
sender_pass = cfg.get('GMAIL', 'GPASS')
from_address = cfg.get('GMAIL', 'FROM')
receiver_address = cfg.get('GMAIL', 'TO')

mail_subject = u'Test from mail LIGTHPATH => GMAIL'
mail_content = u'''Hello,
This is a simple mail. There is only text, no attachments are there The mail is sent using Python SMTP library.
Thank You
'''

envelope = Envelope(from_addr=(from_address, from_address),
                    to_addr=(receiver_address, receiver_address),
                    subject=mail_subject,
                    text_body=mail_content)

# Or send the envelope using a shared GMail connection...
gmail = GMailSMTP(sender_address, sender_pass)
gmail.send(envelope)
Пример #11
0
from envelopes import Envelope, GMailSMTP

envelope = Envelope(from_addr=(u'*****@*****.**',
                               u'From Example'),
                    to_addr=(u'*****@*****.**', u'To Example'),
                    subject=u'Envelopes demo',
                    text_body=u"I'm a helicopter!")

# Send the envelope using an ad-hoc connection...
envelope.send('smtp.googlemail.com',
              login='******',
              password='******',
              tls=True)

# Or send the envelope using a shared GMail connection...
gmail = GMailSMTP('*****@*****.**', 'Amadeuppassword')
gmail.send(envelope)

#[email protected]
#Amadeuppassword
Пример #12
0
from envelopes import Envelope, GMailSMTP

envelope = Envelope(from_addr=('*****@*****.**',
                               'A Scary Pythonista'),
                    to_addr=('*****@*****.**', 'Joe Smith'),
                    subject='Envelopes demo from Gmail account',
                    text_body="this is a test message from a Python program.")
envelope.add_attachment('/Users/chandrashekar/Documents/python-logo.png')

# Send the envelope using an ad-hoc connection...
#envelope.send('smtp.googlemail.com', login='******',
#              password='******', tls=True)

# Or send the envelope using a shared GMail connection...
gmail = GMailSMTP('*****@*****.**', 'slashprog')
r = gmail.send(envelope)
print(r)