コード例 #1
0
def send_invite(email, recipient, event):

    subject = f"Invitation for the event {event['ename']}"
    date_obj = eval(event['date'])
    body = f"""Hello, {recipient} 
You are cordially invited to {event['ename']},  {event['caption']}


Event Details :
        
Date:  { date_obj.strftime("%m/%d/%Y") }.
Location : {event['location'].capitalize()} .
Capacity : {event['nos']}. 

Please register if interested. 
Attendance will be provided.
        """
    ezgmail.send(email, subject, body)
コード例 #2
0
def email():
    ezgmail.init()
    DAYS_AHEAD=1
    start_date = datetime.now().date() + timedelta(days=DAYS_AHEAD)
    end_date = (datetime.now().date() + timedelta(days=DAYS_AHEAD))

    # downloading the earnings calendar
    yec = YahooEarningsCalendar()
    earnings_list = yec.earnings_between(start_date, end_date)
    print(earnings_list)
    # saving the data in a pandas DataFrame
    earnings_df = pd.DataFrame(earnings_list)
    print(earnings_df["startdatetime"])
    earnings_df["startdatetime"]= earnings_df['startdatetime'].astype(str).str[:-14]
    earnings_df["Link"]="https://finance.yahoo.com/quote/{}".format(earnings_df["ticker"])
    for index, x in enumerate(earnings_df["ticker"]):
        earnings_df["Link"][index]="https://finance.yahoo.com/quote/{}".format(x)
    print(earnings_df["startdatetime"])
    print(earnings_df)
    earnings_df.to_csv( r"C:\Users\MIKEB\Desktop\Python\Fuhnance\Earnings_For_{}.csv".format(start_date))
    e,g,l=generate_dfs(10)
    msg="Top Gainers Today:\n\n"
    for index,x in enumerate(g["Symbol"]):
        try:
            line=f"{x} | {g['Name'][index]} | {g['% Change'][index]}% | https://finance.yahoo.com/quote/{x}\n\n"
            msg=msg+line
        except:
            pass
        print(msg)
    msg=msg+"\n\nTop Losers Today:\n\n"
    for index,x in enumerate(l["Symbol"]):
        try:
            line=f"{x} | {l['Name'][index]} | {l['% Change'][index]}% | https://finance.yahoo.com/quote/{x}\n\n"
            msg=msg+line
        except:
            pass
    msg=msg+"\n\nEarnings Action Today:\n\n"
    for index,x in enumerate(e["ticker"]):
        line=f"{x} | {e['companyshortname'][index]} | {e['startdatetimetype'][index]} | {round(e['% Change'][index],2)}% | https://finance.yahoo.com/quote/{x}\n\n"
        msg=msg+line
    print(msg)
    #for x in ["*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**"]:
    for x in ["*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**"]:
        ezgmail.send(x,"Gainers, Losers, and Earnings {}".format(start_date),msg,r"C:\Users\MIKEB\Desktop\Python\Fuhnance\Earnings_For_{}.csv".format(start_date))
コード例 #3
0
def show_files(pattern):
    try:
        download_dir = Path(os.environ['DOWNLOAD_DIR'])
        destination_dir = Path(os.environ['DESTINATION_DIR'])
    except KeyError:
        logger.exception('Failed to pull environment variables')
        sys.exit(1)

    copied = [x.name for x in destination_dir.glob(pattern)]
    for file in [
            x for x in download_dir.glob(pattern) if x.name not in copied
    ]:
        logger.info(f'Copying {file}...')
        shutil.copy(file, destination_dir)
        ezgmail.send(
            recipient=os.environ.get('GMAIL_RECIPIENT', ezgmail.EMAIL_ADDRESS),
            subject='Added file to FTP',
            body='The following file was successfully added to the ftp:\n\n'
            f'{file.name}\n\n'
            'Thanks,')
コード例 #4
0
def SendEmail(alarm):

    # create variables for sending through ezgmail
    email_address = alarm.get_alarm_contact()
    name = alarm.get_alarm_name()
    description = alarm.get_alarm_description()
    reminder = alarm.get_alarm_reminder()

    # email body
    body = '''
 This is your scheduled reminder that the following task is due %s

 Alarm Title: %s
 Alarm Description: %s
  ''' % (reminder, name, description)

    # Send the email
    ezgmail.send(email_address, name, body)

    return 0
コード例 #5
0
ファイル: test_ezgmail.py プロジェクト: willtejeda/ezgmail
def test_basic():
    assert ezgmail.EMAIL_ADDRESS == TEST_EMAIL_ADDRESS

    attachmentFilename = os.path.join(
        os.path.dirname(os.path.realpath(__file__)), 'attachment.txt')

    # This test doesn't check the results, it just makes sure these functions don't raise any exceptions:
    ezgmail.send(TEST_EMAIL_ADDRESS, TEST_SUBJECT,
                 'This is the body of the email.', [attachmentFilename])
    unreadThreads = ezgmail.unread()
    unreadThreads[
        0]  # NOTE: Make sure the test email account always has at least one unread message.
    ezgmail.summary(unreadThreads, printInfo=False)
    recentThreads = ezgmail.recent()
    msg = recentThreads[0].messages[0]
    msg.sender
    msg.recipient
    msg.subject
    msg.body
    msg.timestamp
    ezgmail.search('mancala')
コード例 #6
0
def myClick():
    myLabel = Label(r, text="Sent!")
    global text
    global subject
    text = (t.get("1.0", 'end-1c'))
    subject = (e.get())
    for item in data:
        spaces = random.randint(0, 10)
        if item[3] == 'na':
            text1 = 'Dear Sir/ Madam ' + spaces * ' ' + ', \n' + str(text)
            curr_email = str(item[2])
            #print(text1)
            ezgmail.send(curr_email, subject, text1)
        elif item[3] == 'male':
            text1 = 'Dear Sir ' + str(
                item[1]) + spaces * ' ' + ', \n' + str(text)
            #print(text1)
            curr_email = str(item[2])
            ezgmail.send(curr_email, subject, text1)
        elif item[3] == 'woman':
            text1 = 'Dear Mrs ' + str(
                item[1]) + spaces * ' ' + ', \n' + str(text)
            curr_email = str(item[2])
            #print(text1)
            ezgmail.send(curr_email, subject, text1)

    myLabel.pack()
コード例 #7
0
def Ebay_scrape(emails_on, email):
    global description, url
    item = x
    hi = y
    lo = z
    item = item.replace(' ', '+')
    site = f'https://www.ebay.co.uk/sch/i.html?_from=R40&_nkw={item}&_sacat=0&LH_ItemCondition=3000&_udlo={lo}&_udhi={hi}&rt=nc&LH_BIN=1'
    res = requests.get(site)
    res.raise_for_status()
    soup = bs4.BeautifulSoup(res.text, 'html.parser')
    soupy = soup.select('#srp-river-results > ul > li:nth-child(2) > div > div.s-item__info.clearfix > a')
    try:
        global description
        description = (soupy[0].get_text())
    except:
        Ebay_scrape(emails_on, email)
    for tag in soupy:
        global url
        url = (tag.get('href'))
    if emails_on:
        ezgmail.send(email, description, url)
    print(description, url)
    return description, url
コード例 #8
0
def send_contact_email(app: Flask,
                       message_id: int,
                       contact_email: str, contact_name: str, message_body: str) -> None:
    """
    Forward contact via email, from server address to contact address.

    NB EZGmail requires pre-setup with a credentials.json and token.json, and
    previously run ezgmail.init(), which must be obtained on a personal machine,
    as PythonAnywhere's server does not permit operations needed to
    authenticate. These credentials are obtained from
    https://console.cloud.google.com/apis/dashboard and a Desktop application
    type credential must be selected (since the auth is being done on a personal
    machine). The credentials must be placed in the top folder, with
    README.md/requirements.txt etc.

    Then update message db entry with email_sent=True.

    :param app: Flask
    :param message_id: int
    :param contact_email: str
    :param contact_name: str
    :param message_body: str
    :return: None
    """

    to_address = app.config['CONTACT_EMAIL_ADDRESS']
    email_subject, email_body = compose_notification_email(contact_email,
                                                           contact_name,
                                                           message_body)

    try:
        assert ezgmail.EMAIL_ADDRESS == app.config['SERVER_EMAIL_ADDRESS']

        ezgmail.send(recipient=to_address, subject=email_subject, body=email_body)
        app.DATABASE.email_sent(message_id)
    except Exception as e:
        print(e)
コード例 #9
0
def mail():
    voice1 = pyttsx3.init()
    r = sr.Recognizer()
    voice1.say("Sorry you will have to enter the email address manually")
    voice1.say("Enter recipant")
    voice1.runAndWait()
    recipant = input("Enter recipant :")
    with sr.Microphone() as source1:
        print("Enter Email Subject :")
        voice1.say("Enter Email Subject")
        voice1.runAndWait()
        audio1 = r.listen(source1)
        try:
            text1 = r.recognize_google(audio1)
            print(f"Subject :{text1}\n")
            subject = text1
            with sr.Microphone() as source2:
                print("Compose Email :")
                voice1.say('compose mail')
                voice1.runAndWait()
                audio2 = r.listen(source2)
                try:
                    text2 = r.recognize_google(audio2)
                    print(f"Text :{text2}\n")
                    text0 = text2

                    ezgmail.send(recipant, subject, text0)

                except:
                    print("Error")
                    voice1.say("error")
                    voice1.runAndWait()
        except:
            print("Error")
            voice1.say("error")
            voice1.runAndWait()
コード例 #10
0
print('\nEmail addresses:')
for email in emails:
    print('- ' + email)
print('\nChores:')
for chore in chores:
    print('- ' + chore)

print('\nAttempting to log into gmail API...')
os.chdir(FILEPATH)
try:
    initialize = ezgmail.init()
    print('Login successful!')
except Exception as e:
    print('ERROR! Unable to log into gmail API.\nError Message: {}'.format(e))

try:
    print('\nDelegating tasks...')
    # print('\n\nemail list TEST')
    # for email in emails:
    #     print('- ' + email)
    for email in emails:
        randomChoice = random.choice(chores)
        print('Sending email to {} for the following task: {}'.format(
            email, randomChoice))
        ezgmail.send(email, subject, msgBody + randomChoice)
        chores.remove(randomChoice)
    print('\nEmails have been successfully sent! Exiting application')
except Exception as e:
    print('ERROR! Unable to send email.\nError Message: {}'.format(e))
コード例 #11
0
application_start_time = time.time()

initialise_email()
create_subscription(token)
# create_bnum(token)

for key in scraper_config_snow:
    run_snow_process(scraper_config_snow, key)

for key in scraper_config_snow:
    for contact in list_of_subscribers:
        if key in contact.snow_preferences:
            email_body_snow[key] = build_email_body_snow(
                key, scraper_config_snow[key]['dataframe'], contact.name,
                scraper_config_snow[key]['mountain_snowfall'])
            ezgmail.send(
                contact.email, key + ' Snow Report', email_body_snow[key],
                local_folder_table_dumps + '/' + key + 'SnowReport.csv')

            sms_body_snow[key] = build_sms_body_snow(
                key, scraper_config_snow[key]['dataframe'], contact.name,
                scraper_config_snow[key]['mountain_snowfall'])
            if sms_body_snow[key] != None:
                send_sms(token, contact.phone_number, sms_body_snow[key])
    os.remove(local_folder_table_dumps + '/' + key + 'SnowReport.csv')
    os.remove(local_folder_table_dumps + '/' + key + 'Dict.csv')

log_application_footer(application_start_time)

# To Do List:
コード例 #12
0
ファイル: manage_mail.py プロジェクト: gigimic/scripts_all
# EZGmail is not produced by or affiliated with Google; find the official
# Gmail API documentation at https://developers.google.com/gmail/api/v1/reference/.

# Before you write code, you must first sign up for a Gmail email account
# at https://gmail.com/. Then, go to https://developers.google.com/gmail/api/quickstart/python/,
# click the Enable the Gmail API button on that page, and fill out the form that appears.

# download the credentials.json file
# The folder containing the credentials file must be the current working directory

import ezgmail, os
os.chdir(r'C:\path\to\credentials_json_file')
ezgmail.init()

# Sending Mail from a Gmail Account
ezgmail.send('*****@*****.**', 'Subject line', 'Body of the email')

# adding cc and bcc to messages
ezgmail.send('*****@*****.**',
             'Subject line',
             'Body of the email',
             cc='*****@*****.**',
             bcc='[email protected],[email protected]')

# If you need to remember which Gmail address the token.json file
# is configured for, you can examine ezgmail.EMAIL_ADDRESS.

ezgmail.init()
ezgmail.EMAIL_ADDRESS

# reading mail from gmail account
コード例 #13
0
ファイル: main.py プロジェクト: eivl/Homework-Reminder
    read = reader.readlines()
    for item in read:
        if item not in already:
            already.append(item)
    now = datetime.datetime.now()

    for item in already:
        condition = False
        heading, work, deadline = item.split(" -- ")
        deadline_date, deadline_month, deadline_year = map(
            int, deadline.split("/"))
        last_date = datetime.datetime(deadline_year, deadline_month,
                                      deadline_date)
        t1 = last_date - now
        t1 = str(t1)
        try:
            days, hours = t1.split(", ")
            days = days.strip(" days")
            days = int(days)
            if days == 1:
                condition = True
        except:
            condition = True
        if condition and work not in notification_sent:
            print("found")
            for jtem in people:
                content = "Dear " + jtem + "\n" + "work is : " + work + "\n" + "deadline is approaching!" + "\n" + "\n" + "Regards:" + "\n" + "hwreminder.py"  # you can customize the content of the email
                subject = heading
                ezgmail.send(jtem, subject, content)
            notification_sent.append(work)
コード例 #14
0
import ezgmail
#ezgmail.init()
#ezgmail.send("*****@*****.**","test mail", "Pls respond")
recent_mails = ezgmail.recent()
recursive_string = ""
for mails in recent_mails:
    recursive_string += mails.snippet + "\n"

print(recursive_string)

ezgmail.send("*****@*****.**", "Recursive", recursive_string)
コード例 #15
0
ファイル: PayPalCS.py プロジェクト: szelim/PayPalCS
def sendemail():
    # Add email address here.
    ezgmail.send('*****@*****.**', 'Canceled contributions', 'Please download the attached file to see canceled '
                                                           'contributions.', ['CancelledContributions.csv'])
    print("Email sent.")
コード例 #16
0
    max_page_width = pdf.w - 2 * pdf.l_margin

    pdf.multi_cell(max_page_width, 1, leonardSays)

    pdf.ln(2.0)

    pdf.output('angryLeonard.pdf', 'F')

    pages = convert_from_path(
        r'C:\Users\Max\eclipse-workspace\pyBot\angryLeonard.pdf')

    pages[0].save('angryLeonard.jpg', 'JPEG')


print("lookat is " + str(lookAt))

try:
    while (count < lookAt):
        if (Threads[count].messages[0].sender.find(
                "*****@*****.**") != -1):
            Threads[count].markAsRead()
            leonardSays = random.choice(leonard_responses)
            PDFCreation()
            ezgmail.send('*****@*****.**', 'Bot Email :)', leonardSays,
                         ['angryLeonard.jpg'])
            print('lookout leonard sent an email')
        count = count + 1

except Exception:
    print("something broke grr")
コード例 #17
0
 def send_email(self, recipients, subject='Test subject', body='Probando'):
     for recipient in recipients:
         ezgmail.send(recipient=recipient, subject=subject, body=body)
コード例 #18
0
import ezgmail
import os
UnreadThreads = ezgmail.unread()
ezgmail.summary("unreadThreads")
ezgmail.init()
ezgmail.EMAIL_ADDRESS('*****@*****.**')
os.chdir('/Users/ezrahampton/PycharmProjects/untitled')

ezgmail.send('*****@*****.**',
             'python scripting',
             "Hello all and welcome to the new age of tech and such",
             cc='*****@*****.**',
             bcc='[email protected],')
コード例 #19
0
        dis_list = aw.calculate_dispatch_days(dis_data, dis_name)
        dis_list = aw.reverse_sort_dates(dis_list, 2)
        msg_block = aw.dispatch_msg_creator(dis_list)
        directive_titles.append("Overdue Dispatches")
        directive.append(msg_block)
    #
    #ZOAREP
    #
    if title == "ZOAREP.XLSX":
        msg_block = ''
        zoa_data = xl.open_excel(root_source + title, "Sheet1")
        zoa_list = aw.calculate_zoarep_days(zoa_data, 3)
        uic_list = aw.grab_unique_uics(zoa_list, 0)
        msg_block = aw.zoarep_msg_creator(zoa_list)
        directive_titles.append("ZOAREP")
        directive.append(msg_block)

for msg in msg_arr:
    directive_titles.append("Overdue Services")
    directive.append(msg)

###############################################################################
#                          TEXT CANNON
###############################################################################
for index, msg in enumerate(directive):
    ezgmail.send(contact, directive_titles[index], msg)

#(1.) Ensure the raspberry pi has full compliance with the required libraries
#(2.) Create a folder on desktop that will hold all of our scripts.
#(3.) Learn how to create a cron job, call the sh script which points to our python script.
コード例 #20
0
    def action(self, spoken_text, arguments_list: list = []):
        # Set the input queue of the speech object to the arguments list if it
        # exists. This will ensure that all hear & approve commands in this
        # feature will get input from the arguments list in order instead of
        # asking the user for input. Hence, the arguments list provided should
        # have as many items as there are hear & approve commands in this
        # feature.
        if (len(arguments_list) > 0):
            self.bs.set_input_queue(arguments_list)
        recipient = self.get_recipient(spoken_text)
        if not recipient:
            recipient = self.bs.ask_question(
                'Who do you want to send the email to?')
            if not recipient:
                return

        close_names = []
        known_contacts = self.get_contact_names()
        while close_names == []:
            close_names = difflib.get_close_matches(recipient, known_contacts)
            if close_names == []:
                recipient = self.bs.ask_question(
                    """Could not find this contact. Please try again
                    (say 'stop' or 'cancel' to exit."""
                )
                if not recipient:
                    return
        try:
            recipient_email = self.get_email(close_names[0])
        except Exception as e:
            print(e)
            self.bs.respond(
                """An error occured.
                 I will stop trying to send an email now."""
            )
            return

        # get subject
        subject = self.bs.ask_question('What is the subject of your email?')
        if not subject:
            return

        # get message
        message = self.bs.ask_question('What is the message of your email?')
        if not message:
            return

        # show summary email
        self.bs.respond('Here is a summary of your email:')
        print(self.summary_email(recipient_email, subject, message))

        # edit email
        if self.bs.approve("Would you like to edit this?"):
            edited_email = self.term_email_edit(
                recipient_email, subject, message)
            edited_email_json = json.loads(edited_email)
            recipient_email = edited_email_json["recipient_email"]
            subject = edited_email_json["subject"]
            message = edited_email_json["message"]
            self.bs.respond('Here is another summary of your email:')
            print(self.summary_email(recipient_email, subject, message))
        if self.bs.approve("Would you like to send this email?"):
            # send email
            ezgmail.init(
                tokenFile=self.gmail_creds_folder+'token.json',
                credentialsFile=self.gmail_creds_folder+'credentials.json'
            )
            message += "\n\n Bumblebee (Zintan's ai assistant)"
            ezgmail.send(recipient_email, subject, message)
            self.bs.respond('I have sent the email.')
        else:
            self.bs.respond('Okay.')
        return
コード例 #21
0
ファイル: ezgmail_sample.py プロジェクト: TryOC-1/dev-study
"""ezgmail_sample.py
ezgmail 라이브러리 활용
"""
import ezgmail

# 인증 진행
ezgmail.init()

# 인증된 이메일 주소 출력
print(f"내 이메일 주소: {ezgmail.EMAIL_ADDRESS}")

# 메일 보내기
ezgmail.send(
    recipient="*****@*****.**",  # 받는이
    subject="Subject line",  # 주제문
    body="Body of the email",  # 본문
    attachments=["attachment.txt"],  # 첨부 파일들
    cc=None,  # 참조
    bcc=None,  # 비밀참조
)

# 읽지 않은 메일 확인하기
unread_threads = ezgmail.unread()  # GmailThread 객체 리스트 반환
ezgmail.summary(unread_threads)

# 메일 속성 접근하기
print(f"안 읽은 메일 갯수: {len(unread_threads)}")
unread = unread_threads[0]
print(f"GmailThread 문자열 값: {unread}")
print(f"안 읽은 첫 번째 메일의 메시지 갯수: {len(unread.messages)}")
print(f"  메시지 주제문: {unread.messages[0].subject}")
print(f"  메시지 본문: {unread.messages[0].body}")
コード例 #22
0
Bit = ts.digital(symbol='BTC', market='USD')


def calculate_ma(start, end):
    sum = 0
    for x in range(start, end):
        temp = Bit.iloc[x].loc['4a. close (USD)']
        sum = sum + temp
    average = sum / abs((start - end))
    return (average)


MA200_T = calculate_ma(-200, 0)
MA50_T = calculate_ma(-50, 0)
MA200_Y = calculate_ma(-201, -1)
MA50_Y = calculate_ma(-51, -1)

Diff_Y = MA50_Y - MA200_Y
Diff_T = MA50_T - MA200_T
print('Moving average difference was ' + str(Diff_Y) + ' yesterday')
print('Moving average difference is ' + str(Diff_T) + ' today')
if (Diff_Y < 0 and Diff_T > 0):
    print(
        'There is a 50 and 200 day MA golden cross!! You need to buy Bitcoin today.'
    )
    ezgmail.send(
        '*****@*****.**', 'Buy Bitcoin today!',
        'There is a golden cross signal for Bitcoin today. you need to buy it')
else:
    print('There is no signal')
コード例 #23
0
import ezgmail

#Checks work email for unread emails

unreadThreads = ezgmail.unread()

ezgmail.summary(unreadThreads)

# Reads number of unread threads
print('You have ' + str(len(unreadThreads)) +
      ' unread thread(s) in your work email')

# Prints first unread email with all contents
print(str(unreadThreads[0].messages[0]))

# Prints subject of first unread email
print(unreadThreads[0].messages[0].subject)

# Prints body of first unread email
print(unreadThreads[0].messages[0].body)

print(unreadThreads[0].messages[0].timestamp)

print(unreadThreads[0].messages[0].sender)

print(unreadThreads[0].messages[0].recipient)
ezgmail.send(
    '*****@*****.**', 'You have ' + str(len(unreadThreads)) +
    ' unread thread(s) in your work email',
    'Please read your unread threads from ' +
    unreadThreads[0].messages[0].sender)
コード例 #24
0
ファイル: auto_gmail.py プロジェクト: LeeDonovan/CSULB-Codes
import ezgmail
ezgmail.send('email', 'Subject Line', 'Paragraph')
コード例 #25
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 13 19:44:11 2020

@author: nick

this will email myself.
its simply a test
"""
import ezgmail
try:
    ezgmail.send("*****@*****.**","this was sent from python code", "the body of this message is pretty amazing")
    print("email sent")
except:
    print("failed")
コード例 #26
0
def send_email(recipient, subject, body):
    logging.info("Atempting to send email.\n" + "Recipient: " + recipient +
                 "\n" + "Subject: " + subject + "\n" + "Body: " + body)
    print("Attempting to send and email")
    ezgmail.send(recipient, subject, body)
コード例 #27
0
def send_notification():
    ezgmail.send('*****@*****.**', 'Appointment Available!',
                 'Put info here')
    while True:
        playsound('alarm.wav')
コード例 #28
0
subject_line = 'Reminder to pay Chanda'
email_body = 'In a few hours, we are coming to an end of our fiscal year. \n\nI request all of you who have not yet ' \
             'completely paid their Khuddam Chanda, or not paid as per the rate, to kindly pay it in full online at ' \
             'chanda.mkausa.org. \n\nWe should always remember that financial contribution is a means of bringing us ' \
             'closer to Allah the Almighty, who provides for us every day of the year, every year. ' \
             '\nMay Allah provide all the means for your physical and spiritual sustenance. JazakAllah. \n\nWassalam,' \
             '\nAreeb Amjad'

print("\nThis is the list of people who have not paid their dues:")
print(email_list)

while True:
    send_email = input("\nDo you want to send a reminder email to these addresses? (Y/N): ")
    if send_email in ["Y", "y"]:
        for email in email_list:
            ezgmail.send(email, subject_line, email_body)
        break
    elif send_email in ["N", "n"]:
        print("Ok. The email won't be sent. Terminating program.")
        break
    else:
        print("Please type either 'Y' (for yes) or 'N' (for no).")

quit()






コード例 #29
0
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 13 17:46:17 2020

@author: tylerkim

http://automatetheboringstuff.com/2e/chapter18/
"""
import ezgmail, os

os.chdir('/Users/tylerkim/SpyderProjects/AutomatePython/Emails')
ezgmail.init()

ezgmail.send(
    '*****@*****.**', 'FIRST EMAIL', '''
             Dear Tyler,
             
             This is the first email sent with python.
             
             Best,
             Tyler
             ''')

# # attachments
# ezgmail.send('*****@*****.**', 'Subject line', 'Body of the email',
# ['attachment1.jpg', 'attachment2.mp3'])

# # cc & bcc
# ezgmail.send('*****@*****.**', 'Subject line', 'Body of the email',
# cc='*****@*****.**', bcc='[email protected],[email protected]')
コード例 #30
0
 def send_email(self, subject, body):
     self.subject = subject
     self.body = body
     ezgmail.send(email_data['email address'], self.subject, self.body)