-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from cs161-staff/awstesting
Awstesting
- Loading branch information
Showing
5 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ This page will list out quick responses, common bugs and their fixes, as well as | |
## After walking through [GETTING_STARTED.md](https://github.com/cs161-staff/extensions/blob/master/GETTING_STARTED.md) | ||
* [The Form Responses tab is filling, but the Roster tab is not](#the-form-responses-tab-is-filling-but-the-roster-tab-is-not) | ||
* [I need to change the name of the slack channel](#i-need-to-change-the-name-of-the-slack-channel) | ||
* [I want to add custom comments without copy-pasting](#I-want-to-add-custom-comments-without-copy-pasting) | ||
## Error messages | ||
* ["Student \<name\> responded '' to DSP question in extension request, but is not marked for DSP approval on the roster. Please investigate!"](#snr) | ||
* ["Error: ('An error occurred while sending an email:', Exception(... Insufficient system storage', '[email protected]'))"](#cs162) | ||
|
@@ -35,6 +36,15 @@ This page will list out quick responses, common bugs and their fixes, as well as | |
### I need to change the name of the slack channel | ||
>No problem! Changing the name of the slack channel where the webhook points will not affect it. You should be able to do this with no consequences. | ||
### I want to add custom comments without copy-pasting | ||
>You can take advantage of google sheets to do this! On a separate tab, type out any comments you want to be able to toggle off and on for any given email. | ||
 | ||
|
||
>Back in the roster tab, create two new columns. In one of the columns, column 1, insert a checkbox. In the other column, column 2, you can use the formula `IF(\<cell from column 1\>, \<cell of comment\>, "")`. If you want multiple comments you can use concatenate. | ||
 | ||
|
||
>To include the comment, toggle on the check box. If the checkbox is unchecked, the formula above will include an empty string instead of the comment. | ||
<div id="snr"></div> | ||
|
||
### "Student \<name\> responded '' to DSP question in extension request, but is not marked for DSP approval on the roster. Please investigate!" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,10 @@ | |
|
||
import os | ||
from datetime import datetime, timedelta | ||
from email.mime.multipart import MIMEMultipart | ||
from email.mime.text import MIMEText | ||
from email.utils import formataddr | ||
from smtplib import SMTP_SSL, SMTPException | ||
from typing import List | ||
|
||
from sicp.common.rpc.mail import send_email | ||
|
@@ -99,7 +103,7 @@ def fmt_date(dt: datetime): | |
body=body, | ||
) | ||
|
||
def send(self) -> None: | ||
def OLDsend(self) -> None: | ||
# TODO: When 162 adds HTML support, bring back HTML emails. | ||
# html_body = Markdown().convert(self.body) | ||
# extra_headers = [("Content-Type", "text/html; charset=UTF-8")] | ||
|
@@ -125,3 +129,46 @@ def send(self) -> None: | |
|
||
except Exception as e: | ||
raise EmailError("An error occurred while sending an email:", e) | ||
|
||
|
||
def send(self) -> None: | ||
PORT = 465 # For starttls | ||
HOST = "bcop.berkeley.edu" | ||
username = "svc-bcop-seamless-learning" | ||
sender_email = "[email protected]" | ||
SENDERNAME = Environment.get(ENV_EMAIL_FROM) | ||
receiver_email = self.to_email | ||
cc_emails = self.cc_emails | ||
reply_to_email = self.reply_to_email | ||
password = "RbLgAvAcba3Ba3chbsW5VQ4Z" | ||
SUBJECT = self.subject | ||
# message = """\ | ||
# Subject: Hi there | ||
|
||
# This message is sent from Python.""" | ||
|
||
BODY_TEXT = ("BCOP TEST TEST") | ||
|
||
msg = MIMEMultipart('alternative') | ||
msg['Subject'] = SUBJECT | ||
msg['From'] = formataddr((SENDERNAME, sender_email)) | ||
msg['To'] = receiver_email | ||
msg.add_header('reply-to', reply_to_email) | ||
if len(cc_emails) > 0: | ||
msg['CC'] = ",".join(cc_emails) | ||
# Comment or delete the next line if you are not using a configuration set | ||
# msg.add_header('X-SES-CONFIGURATION-SET',CONFIGURATION_SET) | ||
|
||
# Record the MIME types of both parts - text/plain and text/html. | ||
part1 = MIMEText(self.body, 'plain') | ||
|
||
# Attach parts into message container. | ||
# According to RFC 2046, the last part of a multipart message, in this case | ||
# the HTML message, is best and preferred. | ||
msg.attach(part1) | ||
|
||
with SMTP_SSL(HOST, PORT) as server: | ||
server.login(username, password) | ||
server.sendmail(sender_email, receiver_email, msg.as_string()) | ||
server.close() | ||
print("Email sent!") |