我正在尝试在我的一个视图中发送电子邮件消息,并希望格式化消息的正文,使其显示在不同的行中。
这是一个片段代码views.py
:
body = "Patient Name: " + patient_name + \
"Contact: " + phone + \
"Doctor Requested: Dr. " + doctor.name + \
"Preference: " + preference
email = EmailMessage('New Appointment Request', body, to=['ex@gmail.com'])
email.send()
电子邮件显示如下:
Patient Name: AfrojackContact: 6567892Doctor Requested: Dr. IrenaPreference: Afternoon
我如何使它显示如下:
Patient Name: Afrojack
Contact: 6567892
Doctor Requested: Dr. Irena
Preference: Afternoon