Skip to content

Commit

Permalink
Issue #3 - ارسال ایمیل از طریق ایمیل ce شورا send email settings adde…
Browse files Browse the repository at this point in the history
…d to project
  • Loading branch information
Khedesh committed Aug 6, 2016
1 parent 38d3416 commit b5376d3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
from announcements.models import Announcement
from shamsi.templatetags.shamsi_template_tags import pdatetime

from django.core.mail import EmailMessage


def home(request):
go_course = False
try:
Expand All @@ -33,6 +36,8 @@ def home(request):


def index(request):
#email = EmailMessage('Hello', 'World', 'Shora CE', to=['[email protected]'])
#email.send()
announcements = Announcement.objects.order_by('-date')[:5]
for an in announcements:
an.date = pdatetime(an.date)
Expand Down
15 changes: 15 additions & 0 deletions shora/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,18 @@
if os.path.exists(f):
exec (open(f, "rb").read())

# Email Settings
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

# Host for sending e-mail.
EMAIL_HOST = 'smtp.ce.sharif.edu'
#EMAIL_HOST = 'smtp.gmail.com'

# Port for sending e-mail.
#EMAIL_PORT = 465
EMAIL_PORT = 587

# Optional SMTP authentication information for EMAIL_HOST.
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'shora9412'
EMAIL_USE_TLS = True

0 comments on commit b5376d3

Please sign in to comment.