试图欺骗电子邮件地址 [英] Trying to spoof an email address

查看:157
本文介绍了试图欺骗电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确定有人问过这个问题,但是我找不到让我工作的任何东西。

I'm sure this has been asked, but I can't find anything to get mine to work.

我正尝试发送后续电子邮件至客户,但我想欺骗电子邮件地址,因此发件人地址适用于我的同事。我在网上某处看到,标题中的发件人地址只是一个可以编辑的文本字段,但我仍然无法发送电子邮件。

I'm trying to send follow up emails to clients, but I want to spoof the email address so the from address is for my coworker. I read somewhere online that the from address in the header is simply a text field that can be edited, but I still cannot send the email.

import smtplib

email_to = '*****@gmail.com'
username = '*******@outlook.com'
password = '*********'
other_email = '*******@outlook.com'

mail = smtplib.SMTP('Outlook.com', 25)
mail.ehlo()
mail.starttls()
mail.login(username,password)

header = ('To:' + email_to + '\n' +'From: ' + other_email + '\n'
          + 'Subject: Python Project Test\n')
message = (header +
           '\n\n This is a test message generated from a Python script. \n\n')

mail.sendmail(username, email_to, message)
mail.close()
print("Email sent successfully.")

我知道可以做到,但是有人可以指出我正确的方向吗?有什么办法让我在发件人字段中将我的名字伪装成应该得到此电子邮件的电子邮件?

I know this can be done, but can someone point me in the right direction? Is there any way for me to disguise my name in the from field as that of the email that is supposed to get this?

========= =====================

===================================

此外,为了完整起见,这里是我得到的错误:

Also, for the sake of completion, here is the error I got:

Traceback (most recent call last):
  File "C:\Users\*****\Desktop\email outlook.py", line 16, in <module>
    mail.sendmail(username, email_to, message)
  File "C:\Users\*****\AppData\Local\Programs\Python\Python36-32\lib\smtplib.py", line 887, in sendmail
    raise SMTPDataError(code, resp)
smtplib.SMTPDataError: (550, b'5.7.60 SMTP; Client does not have permissions to send as this sender')

我希望是否有一种方法可以将other_name用作别名用户名。

I was hoping if there was a way to make the other_name an alias of the username.

推荐答案

非常简短版本:

The very short version: This isn't going to work.

从前,有可能按您的要求去做。过去,当互联网很小且不存在垃圾邮件时,接收服务器只会信任您。您只需连接到mail.example.com并说您代表某人@ example.org发送邮件,example.com便会相信您。

Once upon a time, it was reasonably possible to do what you are asking to do. In the old days, when the internet was small and spam did not exist, the receiving server would just trust you. You could just connect to mail.example.com and say you were sending on behalf of someone@example.org, and example.com would just believe you.

但是那些天已经过去了。如今,SMTP服务器的信任度已大大降低。因此,让我们来解决一下您的方法存在的问题:

But those days are over and done with. Nowadays, SMTP servers are a lot less trusting. So let's go through the problems with your approach:


  1. 您正在尝试通过Outlook.com路由电子邮件。 outlook.com非常清楚您是用户名,而不是 other_email 。如果要以 other_email 发送电子邮件,则需要以 other_email 进行身份验证。

  2. 您可以直接连接到gmail.com,声称自己是Outlook.com,然后尝试以这种方式发送电子邮件。但是Gmail知道您不是Outlook.com,因为您缺少这些东西。因此,它很可能会将您的邮件标记为垃圾邮件,退回甚至是*接受然后完全丢弃。

  1. You are trying to route your email through outlook.com. outlook.com knows perfectly well that you are username and not other_email. If you want to send email as other_email, you need to authenticate as other_email.
  2. You could connect directly to gmail.com, claim to be outlook.com, and try to send the email that way. But Gmail knows you're not outlook.com, because you're missing these things. So it will likely flag your message as spam, bounce it, or even* accept it and then discard it entirely.

您可以修复(1)更改代码,但是由于(2),没有什么意义。

You could fix (1) by changing your code, but because of (2), there's little point.

*我不在Gmail团队工作。我猜想Gmail将如何仅基于有关通常配置现代电子邮件服务器的公共信息来对此做出响应。 YMMV。

* I do not work on the Gmail team. I am guessing how Gmail would respond to this based solely on public information about how modern email servers are typically configured. YMMV.

这篇关于试图欺骗电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆