29 lines
780 B
Python
29 lines
780 B
Python
from django.shortcuts import render
|
|
from django.http import HttpResponse
|
|
from django.core.mail import send_mail
|
|
|
|
# Create your views here.
|
|
|
|
def index(request):
|
|
if request.method == "POST":
|
|
message = """Zdravo
|
|
Ovo je automatski generisana poruka u svrhu testiranja naseg servisa
|
|
|
|
Vaš,
|
|
Kivi-cars tim
|
|
"""
|
|
|
|
subject = "Kivi-Cars - novi zahtjev za pretragu"
|
|
email = request.POST.get('email')
|
|
|
|
print(subject, email)
|
|
|
|
# function to send mail
|
|
send_mail(subject, message, 'saburlymailer@gmail.com', [email])
|
|
|
|
return HttpResponse('Success, check your email!')
|
|
|
|
return render(request, 'mailer/form.html')
|
|
|
|
|