そのため、考えられるすべての組み合わせを試しましたが、reply_to
オブジェクトをヘッダーに渡すことができません。reply_toメールアドレスをハードコーディングしても。フォームはそれ以外は問題なく動作します。ご協力ありがとうございました
バージョン
Django==1.10.1
sendgrid==3.6.3
sendgrid-django==4.0.4
見る
def index(request):
form_class = FooterForm
if request.method == 'POST':
form = form_class(data=request.POST)
if form.is_valid():
fullname = request.POST.get('fullname')
phone_number = request.POST.get('phone_number')
email_address = request.POST.get('email_address')
message_content = request.POST.get('message_content')
subject = 'Contact Information Submitted from Trust and Beneficiary Advocates'
from_email = settings.DEFAULT_FROM_EMAIL
recipient_list = '[email protected]'
bcc = '[email protected]'
ctx = {
'title': 'Trust and Beneficiary Advocates',
'subject': subject,
'fullname': fullname,
'phone_number': phone_number,
'email_address': email_address,
'message_content': message_content
}
message = get_template('email_forms/contact_form_email.html').render(Context(ctx))
msg = EmailMessage(
subject,
message,
from_email,
[recipient_list],
[bcc],
reply_to=['[email protected]']
)
msg.content_subtype = 'html'
msg.send()
return redirect('/thank-you/')
return render(request, 'pages/index.html', {
'form': form_class, 'title': 'Trust and Beneficiary Advocates'
})
reply_toの組み合わせを試しました
reply_to=['[email protected]']
headers={'Reply-To': '[email protected]'}
コードは問題ないように見えます-使用reply_to=['[email protected]']
はDjango1.8以降で機能するはずです。
sendgrid-djangoでこのバグに遭遇したようです。プルリクエスト51で修正を適用してみるか(単一の返信先アドレスのみをサポートしますが、場合によっては問題ないように見えます)、別のサービスに切り替えてメールを送信することもできます。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加