chore(email): adjust email configuration to reduce spam

This commit is contained in:
bobbyvish
2024-11-06 14:39:50 +05:30
parent 540442fa28
commit eef12c8579
8 changed files with 9 additions and 7 deletions

View File

@@ -123,7 +123,7 @@ class RegistrationEmailView(APIView):
email_service = EmailService( email_service = EmailService(
subject="Good Times - OTP", subject="Good Times - OTP",
to=[email], to=[email],
from_email=settings.EMAIL_HOST_USER, from_email=settings.DEFAULT_FROM_EMAIL,
) )
email_service.load_template( email_service.load_template(
"otp/otp.html", context={"OTP": otp, "action": "Register"} "otp/otp.html", context={"OTP": otp, "action": "Register"}
@@ -322,7 +322,7 @@ class OtpRequestView(APIView):
email_service = EmailService( email_service = EmailService(
subject="Good Times - OTP", subject="Good Times - OTP",
to=[email], to=[email],
from_email=settings.EMAIL_HOST_USER, from_email=settings.DEFAULT_FROM_EMAIL,
) )
email_service.load_template( email_service.load_template(
"otp/otp.html", context={"OTP": otp, "action": "Login"} "otp/otp.html", context={"OTP": otp, "action": "Login"}

View File

@@ -1017,7 +1017,7 @@ class CustomerTransferView(LoginRequiredMixin, generic.View):
email_service = EmailService( email_service = EmailService(
subject="Your Exclusive Account Access Details with Good Times!", subject="Your Exclusive Account Access Details with Good Times!",
to=principal_obj.email, to=principal_obj.email,
from_email=settings.EMAIL_HOST_USER, from_email=settings.DEFAULT_FROM_EMAIL,
) )
# Send the email # Send the email

View File

@@ -23,6 +23,7 @@ EMAIL_PORT=
EMAIL_HOST_USER= EMAIL_HOST_USER=
EMAIL_HOST_PASSWORD= EMAIL_HOST_PASSWORD=
EMAIL_USE_TLS= EMAIL_USE_TLS=
DEFAULT_FROM_EMAIL=
GOOGLE_MAPS_API_KEY= GOOGLE_MAPS_API_KEY=

View File

@@ -239,6 +239,7 @@ EMAIL_HOST_USER = env.str("EMAIL_HOST_USER")
EMAIL_HOST_PASSWORD = env.str("EMAIL_HOST_PASSWORD") EMAIL_HOST_PASSWORD = env.str("EMAIL_HOST_PASSWORD")
EMAIL_PORT = env.str("EMAIL_PORT") EMAIL_PORT = env.str("EMAIL_PORT")
EMAIL_USE_TLS = True EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = env.str("DEFAULT_FROM_EMAIL")
# LOGGING # LOGGING

View File

@@ -56,7 +56,7 @@ class ContactUsReplyView(LoginRequiredMixin, generic.View):
to=[ to=[
email, email,
], ],
from_email=settings.EMAIL_HOST_USER, from_email=settings.DEFAULT_FROM_EMAIL,
) )
print("email_service: ", email_service) print("email_service: ", email_service)
email_service.load_template( email_service.load_template(

View File

@@ -165,7 +165,7 @@ class CreateVenueApi(APIView):
# email_service = EmailService( # email_service = EmailService(
# subject="Good Times - Report", # subject="Good Times - Report",
# to=[user.email], # to=[user.email],
# from_email=settings.EMAIL_HOST_USER, # from_email=settings.DEFAULT_FROM_EMAIL,
# ) # )
# email_service.attach(filename, buffer.getvalue(), "application/pdf") # email_service.attach(filename, buffer.getvalue(), "application/pdf")

View File

@@ -27,7 +27,7 @@ class Command(BaseCommand):
subject="Monthly Event Report", subject="Monthly Event Report",
body="Please find the attached report for the last month.", body="Please find the attached report for the last month.",
to=[email], to=[email],
from_email=settings.EMAIL_HOST_USER, from_email=settings.DEFAULT_FROM_EMAIL,
) )
email_message.attach(filename, pdf_data, "application/pdf") email_message.attach(filename, pdf_data, "application/pdf")
email_message.send() email_message.send()

View File

@@ -26,6 +26,6 @@
<p>We sincerely hope your experience with Good Times has been delightful thus far and look forward to continuing to exceed your expectations!</p> <p>We sincerely hope your experience with Good Times has been delightful thus far and look forward to continuing to exceed your expectations!</p>
<p>Warmest regards,</p> <p>Warmest regards,</p>
Good Times<br> Good Times<br>
{{ settings.EMAIL_HOST_USER }}</p> {{ settings.DEFAULT_FROM_EMAIL }}</p>
</body> </body>
</html> </html>