Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/301.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过python和django通过send mail以编程方式向gmail添加联系人_Python_Django_Email - Fatal编程技术网

通过python和django通过send mail以编程方式向gmail添加联系人

通过python和django通过send mail以编程方式向gmail添加联系人,python,django,email,Python,Django,Email,如果我的用户单击我发送给他的链接,我希望他将我的邮件id添加到他的邮件联系人中。 我该怎么做 这是我的密码 def send_mail_tousers(firstname,confirmation_id,email): subject, from_email, to = 'Thank you for Signing Mysite.','example@gmail.com', email text_content = 'This is an important message.'

如果我的用户单击我发送给他的链接,我希望他将我的邮件id添加到他的邮件联系人中。 我该怎么做

这是我的密码

def send_mail_tousers(firstname,confirmation_id,email):
    subject, from_email, to = 'Thank you for Signing Mysite.','example@gmail.com', email
    text_content = 'This is an important message.'
    html_content = render_to_string('verify.html',{'name':firstname,'id':confirmation_id})
    msg = EmailMultiAlternatives(subject, text_content,'BOSS<example@gmail.com>', [to])
    msg.attach_alternative(html_content, "text/html")
    return msg.send() 
def发送邮件用户(名字、确认号、电子邮件):
主题,从_电子邮件,至='感谢您签署我的网站','example@gmail.com,电邮
text_content='这是一条重要的消息。'
html_content=render_to_string('verify.html',{'name':firstname,'id':confirmation_id})
msg=EmailMultiAlternations(主题、文本内容、'BOSS'、[to])
msg.附加可选内容(html内容,“文本/html”)
返回msg.send()

通过这种方式,我可以向我的用户发送一封HTML内容邮件

大多数邮件客户端要么自动执行此操作,要么只需单击UI中的按钮即可添加邮件联系人


你可以在邮件上贴一张vCard来增加机会;大多数邮件客户端都能识别这些信息,并且可以从中导入更多信息,而不仅仅是名称和电子邮件地址。

我认为大多数邮件客户端中不存在这样的功能,但是您可以发送vCard。没有Cilyan。。。我在某个地方见过。我想要的是,从用户的角度来看,它应该是一个链接或按钮。如果他点击它,需要将我的id自动添加到他的联系人中。可能吗?我不这么认为。大多数邮件客户端将邮件内容视为恶意内容(病毒、垃圾邮件),因此,如果您可以从邮件正文内部“远程控制”邮件客户端,我会非常惊讶。即使使用此功能,也允许您创建一个acc。使用假acc,然后请求验证。