Skip to content

Commit

Permalink
Improved
Browse files Browse the repository at this point in the history
  • Loading branch information
devvspaces committed Aug 21, 2024
1 parent 43eabe2 commit f1bdf56
Show file tree
Hide file tree
Showing 9 changed files with 365 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"autoDocstring.docstringFormat": "sphinx"
"autoDocstring.docstringFormat": "sphinx",
"editor.tabSize": 4
}
1 change: 1 addition & 0 deletions src/config/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
ALLOWED_HOSTS = ["*"]

SEND_GRID = config('SEND_GRID', default='test')
ZEPTOTOKEN = config('ZEPTOTOKEN', default='test')
EMAIL_DOMAIN = config('EMAIL_DOMAIN', default='test')
BLOCK_EMAIL = config('BLOCK_EMAIL', default=True, cast=bool)
DEBUG_EMAIL = config('DEBUG_EMAIL', default=True, cast=bool)
2 changes: 1 addition & 1 deletion src/mailer/templates/mailer/email_templates/email.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<body>

<section>
<h1 id="logo"><img src="https://lanisfinconsult.com/wp-content/uploads/2022/04/logo.png"></h1>
<h1 id="logo"><img src="https://res.cloudinary.com/startup-grind/image/upload/c_fit,dpr_2.0,f_auto,g_center,h_100,q_auto:good,w_500/v1/gcs/platform-data-dsc/contentbuilder/logo_dark_stacked_ziDh4mP.png"></h1>


<div class="email-body">
Expand Down
14 changes: 5 additions & 9 deletions src/mailer/templates/mailer/email_templates/template1.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@

{% block contents %}

<p>{{ message|safe }}</p>
{{ message|safe }}

{% endblock contents %}


{% block footer %}

<p>Your Faithfully,</p>

<p>Steve Malloy</p>
<p>Principal Consultant</p>
<p>LANIS FINANCIAL CONSULTANT LIMITED</p>
<p>Prinses Beatrixlaan 582,</p>
<p>2595 BM Den Haag</p>
<p>Netherlands</p>
<p>Best regards,</p>
<p>Ayanwola Ayomide</p>
<p>GDSC Lead</p>
<p>TechFest 24 Organizing Team</p>

{% endblock footer %}
11 changes: 7 additions & 4 deletions src/mailer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.contrib import messages
from django.shortcuts import redirect
from django.views.generic import TemplateView
from messenger.email_manager import SendGridEmailManager
from messenger.email_manager import ZeptoEmailManager
from messenger.sms_manager import SmsManager
from messenger.messager import ExcelMessenger
from messenger.messsage_manager import HtmlMessageManager
Expand Down Expand Up @@ -61,12 +61,12 @@ def create_sender_manager(self, data: dict):
:param data: form cleaned data
:type data: dict
:return: sender manager
:rtype: SendGridEmailManager
:rtype: Email manager
"""
sender = data.get('sender')
reply_to = data.get('reply_to')
return SendGridEmailManager(
api_key=settings.SEND_GRID,
return ZeptoEmailManager(
api_key=settings.ZEPTOTOKEN,
sender=f"{sender}@{settings.EMAIL_DOMAIN}",
block_send=settings.BLOCK_EMAIL,
debug=settings.DEBUG_EMAIL,
Expand Down Expand Up @@ -121,6 +121,9 @@ def post(self, request, **kwargs):
try:
messenger = self.create_messenger(file_path, form.cleaned_data)

message = message.replace('\n', '<br>')
print(message)

sents_fails = messenger.start_process(
subject=subject,
message=message
Expand Down
2 changes: 1 addition & 1 deletion src/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
def main():
"""Run administrative tasks."""
os.environ.setdefault(
'DJANGO_SETTINGS_MODULE', "config.settings")
'DJANGO_SETTINGS_MODULE', "config.settings.dev")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down
Loading

0 comments on commit f1bdf56

Please sign in to comment.