İşte ne yaptım:
from django.core.mail import EmailMultiAlternatives
from django.template.context import Context
from django.template.loader import get_template
from smtpapi import SMTPAPIHeader
def send_email(subject, template_name, context, to, bcc=None, from_email=settings.DEFAULT_FROM_EMAIL, send_at=None):
header = SMTPAPIHeader()
body = get_template(template_name).render(Context(context))
if send_at:
send_at = {"send_at": send_at}
header.set_send_at(send_at)
email = EmailMultiAlternatives(
subject=subject,
body=body,
from_email=from_email,
to=to,
bcc=bcc,
headers={'X-SMTPAPI': header.json_string()}
)
email.attach_alternative(body, 'text/html')
email.send()
Ben her yerde .. Ve send_at bir zaman damgası
olmalıdır bulamadık başlık
X-SMTPAPI yolunda ayarlamak unutmayın
Ayrıca burada sendgrid.SendGridClient ile değil başlıklarını veya bir şey eklemek nasıl görebiliyordu: https://sendgrid.com/docs/Utilities/code_workshop.html/scheduling_parameters.html
import sendgrid
...
sg = sendgrid.SendGridClient('apiKey')
message = sendgrid.Mail()
message.add_to('John Doe <[email protected]>')
message.set_subject('Example')
message.set_html('Body')
message.set_text('Body')
message.set_from('Doe John <[email protected]>')
message.smtpapi.set_send_at(timestamp)
sg.send(message)
Sorun nedir? –
Onun cevabı :) Ben kılavuzu olarak ekledim .. – Gvidoou
@Gvidoou sizin cevap olarak göndermelisiniz. Söz konusu değil. Ve sonra cevap olarak işaretleyin. – Lucas03