Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: CMD-112 overwrite confirmation e-mail #448

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
26 changes: 0 additions & 26 deletions apps/tup-cms/src/apps/portal/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from django.dispatch import receiver
from djangocms_forms.signals import form_submission
from django.conf import settings
from django.core.mail import send_mail


logger = logging.getLogger(f"portal.{__name__}")
Expand Down Expand Up @@ -43,35 +42,10 @@ def submit_ticket(form_data):
requests.post(f"{service_url}/tickets/noauth", data=ticket_data, files=[])


def send_confirmation_email(form_name, form_data):
email_body = """
<p>Greetings,</p>
<p>
You have successfully submitted a form on the TACC website. Thank you for your submission.
</p>
<p>
Business hours are Monday - Friday, 8AM to 5PM Central. We will respond to your submission
according to the information provided on the form webpage.
</p>
<p>
Sincerely,<br>
TACC Communications
</p>
"""
send_mail(
f"TACC Form Submission Received: {form_name}",
email_body,
"no-reply@tacc.utexas.edu",
[form_data["email"]],
html_message=email_body)


def callback(form, cleaned_data, **kwargs):
logger.debug(f"received submission from {form.name}")
if form.name == 'rt-ticket-form':
submit_ticket(cleaned_data)
elif ('email' in cleaned_data):
send_confirmation_email(form.name, cleaned_data)


class PortalConfig(AppConfig):
Expand Down
29 changes: 29 additions & 0 deletions apps/tup-cms/src/taccsite_cms/settings_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,35 @@

TACC_SOCIAL_SHARE_PLATFORMS = ['linkedin', 'facebook', 'email']

########################
# TACC: EMAIL
########################

PORTAL_SHOULD_SEND_CONF_EMAIL = True
PORTAL_CONF_EMAIL_TEXT = """
Greetings,

You have successfully submitted a form on the {site_name} website. Thank you for your submission.

Business hours are Monday - Friday, 8AM to 5PM Central. We will respond to your submission according to the information provided on the form webpage.

Sincerely,
{site_name} Communications
"""
PORTAL_CONF_EMAIL_HTML = """
<p>Greetings,</p>
<p>
You have successfully submitted a form on the {site_name} website. Thank you for your submission.
</p>
<p>
Business hours are Monday - Friday, 8AM to 5PM Central. We will respond to your submission according to the information provided on the form webpage.
</p>
<p>
Sincerely,<br />
{site_name} Communications
</p>
"""

########################
# DJANGOCMS_BLOG
########################
Expand Down