<commit_before>from django.core.mail import send_mail, BadHeaderError
from django.http import HttpResponse, HttpResponseRedirect
import settings


def send_feedback(request):
    subject = settings.FEEDBACK_SUBJECT
    feedback_address = settings.FEEDBACK_RECIPIENT #, <EMAIL>'
    name = request.POST.get('name', '')
    from_email = "%s <%s>" % (name, request.POST.get('email', ''),)
    reply_email = "feedback <%s>" % feedback_address
    url = request.POST.get('url', '')
    ua = request.META['HTTP_USER_AGENT']
    message = "From: %s\nURL: %s\nBrowser: %s\n\n\n%s" % (from_email, url, ua, request.POST.get('comment', ''),)
    
    if name and message and from_email:
        try:
            send_mail(subject, message, reply_email, feedback_address)
        except BadHeaderError:
            return HttpResponse('Invalid header found.')
        return HttpResponse('Thanks for your feedback.')
    else:
        # In reality we'd use a form class
        # to get proper validation errors.
        return HttpResponse('Make sure all fields are entered and valid.')

# def send_bookmark(request):
#     recipient = request.POST.get('recipient')
#     comment = request.POST.get('comment')
#     link = request.POST.get('link')
#     message = comment + '<p>' + link
#     subject = "a MARCO bookmark"
#     from_email = "<EMAIL>"
    
#     if recipient:
#         try:
#             send_mail(subject, message, from_email, recipient)<commit_msg>this should fix the reply issue in the feedback email<commit_after>from django.core.mail import send_mail, BadHeaderError
from django.http import HttpResponse, HttpResponseRedirect
import settings


def send_feedback(request):
    subject = settings.FEEDBACK_SUBJECT
    feedback_address = settings.FEEDBACK_RECIPIENT #, <EMAIL>'
    name = request.POST.get('name', '')
    from_email = "%s <%s>" % (name, request.POST.get('email', ''),)
    reply_email = "feedback <%s>" % settings.FEEDBACK_RECIPIENT[0]
    url = request.POST.get('url', '')
    ua = request.META['HTTP_USER_AGENT']
    message = "From: %s\nURL: %s\nBrowser: %s\n\n\n%s" % (from_email, url, ua, request.POST.get('comment', ''),)
    
    if name and message and from_email:
        try:
            send_mail(subject, message, reply_email, feedback_address)
        except BadHeaderError:
            return HttpResponse('Invalid header found.')
        return HttpResponse('Thanks for your feedback.')
    else:
        # In reality we'd use a form class
        # to get proper validation errors.
        return HttpResponse('Make sure all fields are entered and valid.')

# def send_bookmark(request):
#     recipient = request.POST.get('recipient')
#     comment = request.POST.get('comment')
#     link = request.POST.get('link')
#     message = comment + '<p>' + link
#     subject = "a MARCO bookmark"
#     from_email = "<EMAIL>"
    
#     if recipient:
#         try:
#             send_mail(subject, message, from_email, recipient)
{'fraction_non_alphanumeric': 0.12845583277140932, 'fraction_numerical': 0.00033715441672285906, 'mean_word_length': 3.1847672778561353, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '202641', 'n_tokens_mistral': 907, 'n_tokens_neox': 893, 'n_words': 232}