Skip to content

Conversation

@sudip-khanal
Copy link
Contributor

Changes

  • Add email templates.
  • Add support for CC recipients in email notification.
  • Add send email notification on EAP registration.

Checklist

Things that should succeed before merging.

  • Updated/ran unit tests
  • Updated CHANGELOG.md

Release

If there is a version update, make sure to tag the repository with the latest version.

@susilnem susilnem changed the title Add email template and setup EAP: Email setup and templates Dec 9, 2025
@sudip-khanal sudip-khanal force-pushed the feat/add-email-setup-and-template branch from 486f463 to 832c190 Compare December 10, 2025 15:17
Copy link
Member

@susilnem susilnem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes

eap/tasks.py Outdated
Comment on lines 33 to 37
cc_recipients = [
instance.national_society_contact_email,
*settings.EMAIL_EAP_DREF_AA_GLOBAL_TEAM,
*regional_coordinator_emails,
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need unique here.

Suggested change
cc_recipients = [
instance.national_society_contact_email,
*settings.EMAIL_EAP_DREF_AA_GLOBAL_TEAM,
*regional_coordinator_emails,
]
cc_recipients = list(
set([
instance.national_society_contact_email,
*settings.EMAIL_EAP_DREF_AA_GLOBAL_TEAM,
*regional_coordinator_emails,
])
)

eap/tasks.py Outdated
email_context = get_eap_registration_email_context(instance)
email_subject = f"[{instance.get_eap_type_display()} IN DEVELOPMENT] {instance.country} {instance.disaster_type}"
email_body = render_to_string("email/eap/registration.html", email_context)
email_type = "EAP-REGISTRATION"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
email_type = "EAP-REGISTRATION"
email_type = "New EAP Registration"

eap/tasks.py Outdated
*regional_coordinator_emails,
]
email_context = get_eap_registration_email_context(instance)
email_subject = f"[{instance.get_eap_type_display()} IN DEVELOPMENT] {instance.country} {instance.disaster_type}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need smth like this, as EAP_type can be set to null.

Suggested change
email_subject = f"[{instance.get_eap_type_display()} IN DEVELOPMENT] {instance.country} {instance.disaster_type}"
email_subject = f"[{instance.get_eap_type_display() if instance.get_eap_type_display() else 'EAP'} IN DEVELOPMENT] {instance.country} {instance.disaster_type}"

</tr>
<tr>
<td style="font-weight: bold;">Type of EAP</td>
<td>{{ eap_type_display }}</td>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be None.

eap/utils.py Outdated
"ns_contact_name": eap_registration_data["national_society_contact_name"],
"ns_contact_email": eap_registration_data["national_society_contact_email"],
"ns_contact_phone": eap_registration_data["national_society_contact_phone_number"],
"status_display": eap_registration_data["status_display"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the National Society contact info for the Kind regards section of the email.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I was asking about status display.

{{ ns_contact_phone }}
</p>
</td>
</tr>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need here to redirect to frontend url..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s not mentioned in the Process Emails docs, but I’ve added it.

@sudip-khanal sudip-khanal force-pushed the feat/add-email-setup-and-template branch from c1ac5ac to aa730e6 Compare December 12, 2025 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants