There is a form for commenting the article, so that when sending the form to the site, it should also be sent to the email of the author who created the article! The question is how to get the email of the author of the article when he is not registered and send him a message!
if request.POST and ("pause" not in request.session): form = CommentForm(request.POST) if form.is_valid(): comment = form.save(commit=False) comment.comments_author = request.user comment.comments_article = Article.objects.get(id=article_id) author = Article.objects.get(id=article_id) form.save() mail_subject = 'You have a massege' message = render_to_string('blogs/masege_to_email.html', { 'user': comment.comments_author, 'author': author }) to_email = author('email') email = EmailMessage( mail_subject, message, to=[to_email] ) email.send() request.session.set_expiry(60) request.session['pause'] = True return redirect('/articles/get/%s/' % article_id)