2015-10-02 87 views
1

我得到了一個錯誤郵件:的smtplib無法發送郵件:550 5.7.1本系統配置爲拒絕虛假的發件人地址

[email protected] 
Your message wasn't delivered due to a permission or security issue. 
It may have been rejected by a moderator, the address may only accept e-mail  
from certain senders, or another restriction may be preventing delivery. 

smtp; 550 5.7.1 This system is configured to reject spoofed sender addresses> #SMTP# 
Original message headers: 
Return-Path: <[email protected]> 
Received: from localhost.localdomain (unknown [192.X.X.X]) (using 
TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client 
certificate requested) by smtpcompany.tw (Postfix) with ESMTPS id CB8752E03B7 for 
<[email protected]>; Fri, 2 Oct 2015 14:24:41 +0800 (CST) 
Content-Type: multipart/mixed; boundary="===============1672092220==" 
MIME-Version: 1.0 
From: <[email protected]> 
To: <[email protected]> 
Subject: We got something 

我堅持了這一段時間 我不知道其中ia錯
我嘗試smtplib.SMTP('smtp.gmail.com',587)作品以及
但公司SMTP失敗
我覺得這條線是weild:

Received: from localhost.localdomain (unknown [192.X.X.X]) 

你有什麼想法嗎?
請幫我謝謝

這裏是代碼:

def send_email(mail_from,mail_to,subject, body): 
    import smtplib 
    from email.mime.multipart import MIMEMultipart 
    fromaddr = mail_from 
    toaddr = mail_to if type(mail_to) is list else [mail_to] 
    msg = MIMEMultipart() 
    msg['From'] = fromaddr 
    msg['To'] = ", ".join(toaddr) 
    msg['Subject'] = subject 
    body = body 
    server = smtplib.SMTP('mail.stmpcompany.tw', 25)  
    server.set_debuglevel(True) 
    server.starttls() 
    text = msg.as_string() 
    server.sendmail(fromaddr, toaddr, text) 
    server.quit() 
+0

你有沒有試過與postadmin交談呢? –

+0

postadmin認爲這是代碼問題。我應該在我的電腦中安裝什麼? – user2492364

+0

錯誤郵件中的'Original message headers'部分之前是否有任何內容? –

回答

0

你的發件人地址(在電子郵件領域)必須對您使用mailsever(mail.stmpcompany.tw)一個現有的電子郵件地址。

該錯誤消息

5.7.1該系統被配置爲拒絕僞造發件人地址

當你在使用電子郵件地址從字段或者不屬於某個域發生

郵件服務器被配置用於該服務器,或服務器也要求具有該電子郵件地址的用戶實際上存在。

您使用gmail進行測試的原因是googles mailserver不檢查發件人地址是否有效。

+0

我認爲你是對的。我真的使用''''從@ mysite.com''''從'''''''http://stackoverflow.com/questions/540976/specify-a-sender-when-sending- mail-with-python-smtplib?rq = 1''''它工作!從@ mysite.com''''使用''''很奇怪,聽起來像是一個假的發送者。但它確實有效。 – user2492364

相關問題