feature/meetings #7
@ -1,6 +1,5 @@
|
||||
from django.core.mail import EmailMultiAlternatives
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.html import strip_tags
|
||||
from django.conf import settings
|
||||
|
||||
class EmailService:
|
||||
@ -16,20 +15,19 @@ class EmailService:
|
||||
'admin_dashboard_url': f"{settings.FRONTEND_URL}/admin/appointments" if hasattr(settings, 'FRONTEND_URL') else '/admin/'
|
||||
}
|
||||
|
||||
html_content = render_to_string('emails/admin_notification.html', context)
|
||||
text_content = strip_tags(html_content)
|
||||
html_message = render_to_string('emails/admin_notification.html', context)
|
||||
|
||||
admin_email = getattr(settings, 'ADMIN_EMAIL', 'hello@attunehearttherapy.com')
|
||||
|
||||
try:
|
||||
email_msg = EmailMultiAlternatives(
|
||||
subject,
|
||||
text_content,
|
||||
settings.DEFAULT_FROM_EMAIL,
|
||||
[admin_email]
|
||||
email = EmailMultiAlternatives(
|
||||
subject=subject,
|
||||
body="Please view this email in an HTML-compatible client.", # Fallback text
|
||||
from_email=settings.DEFAULT_FROM_EMAIL,
|
||||
to=[admin_email],
|
||||
)
|
||||
email_msg.attach_alternative(html_content, "text/html")
|
||||
email_msg.send()
|
||||
email.attach_alternative(html_message, "text/html")
|
||||
email.send(fail_silently=False)
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"Failed to send admin notification: {e}")
|
||||
@ -45,18 +43,17 @@ class EmailService:
|
||||
'user_dashboard_url': f"{settings.FRONTEND_URL}/dashboard" if hasattr(settings, 'FRONTEND_URL') else '/dashboard/'
|
||||
}
|
||||
|
||||
html_content = render_to_string('emails/appointment_scheduled.html', context)
|
||||
text_content = strip_tags(html_content)
|
||||
html_message = render_to_string('emails/appointment_scheduled.html', context)
|
||||
|
||||
try:
|
||||
email_msg = EmailMultiAlternatives(
|
||||
subject,
|
||||
text_content,
|
||||
settings.DEFAULT_FROM_EMAIL,
|
||||
[appointment.email]
|
||||
email = EmailMultiAlternatives(
|
||||
subject=subject,
|
||||
body="Please view this email in an HTML-compatible client.", # Fallback text
|
||||
from_email=settings.DEFAULT_FROM_EMAIL,
|
||||
to=[appointment.email],
|
||||
)
|
||||
email_msg.attach_alternative(html_content, "text/html")
|
||||
email_msg.send()
|
||||
email.attach_alternative(html_message, "text/html")
|
||||
email.send(fail_silently=False)
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"Failed to send scheduled notification: {e}")
|
||||
@ -72,18 +69,17 @@ class EmailService:
|
||||
'user_dashboard_url': f"{settings.FRONTEND_URL}/dashboard" if hasattr(settings, 'FRONTEND_URL') else '/dashboard/'
|
||||
}
|
||||
|
||||
html_content = render_to_string('emails/appointment_rejected.html', context)
|
||||
text_content = strip_tags(html_content)
|
||||
html_message = render_to_string('emails/appointment_rejected.html', context)
|
||||
|
||||
try:
|
||||
email_msg = EmailMultiAlternatives(
|
||||
subject,
|
||||
text_content,
|
||||
settings.DEFAULT_FROM_EMAIL,
|
||||
[appointment.email]
|
||||
email = EmailMultiAlternatives(
|
||||
subject=subject,
|
||||
body="Please view this email in an HTML-compatible client.", # Fallback text
|
||||
from_email=settings.DEFAULT_FROM_EMAIL,
|
||||
to=[appointment.email],
|
||||
)
|
||||
email_msg.attach_alternative(html_content, "text/html")
|
||||
email_msg.send()
|
||||
email.attach_alternative(html_message, "text/html")
|
||||
email.send(fail_silently=False)
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"Failed to send rejection notification: {e}")
|
||||
|
||||
@ -287,13 +287,6 @@
|
||||
<li>Check back next month for updated availability</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Action Button -->
|
||||
<div class="action-section">
|
||||
<a href="{{ user_dashboard_url }}" class="button">
|
||||
Submit New Request
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
|
||||
@ -266,38 +266,6 @@
|
||||
<div class="therapist-info">With: Nathalie (Therapist)</div>
|
||||
</div>
|
||||
|
||||
<div class="">
|
||||
<div class="">
|
||||
<div class="detail-icon">⏰</div>
|
||||
<div class="detail-label">Duration</div>
|
||||
<div class="detail-value">
|
||||
{{ appointment.meeting_duration_display }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="">
|
||||
<div class="detail-label">Session Type</div>
|
||||
<div class="detail-value">Virtual Meeting</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Preparation Tips -->
|
||||
<div class="">
|
||||
<div class="">📋 To Prepare for Your Session</div>
|
||||
<ul class="">
|
||||
<li>Find a quiet, comfortable space for our session</li>
|
||||
<li>Test your internet connection and audio/video</li>
|
||||
<li>Have any notes or questions ready</li>
|
||||
<li>Join the meeting 5 minutes early to get settled</li>
|
||||
<li>Ensure you're in a private, distraction-free environment</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Action Button -->
|
||||
<div class="action-section">
|
||||
<a href="{{ user_dashboard_url }}" class="button">
|
||||
View in Dashboard
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user