2016-07-20 3 views
0

私は、Pythonを使用して、いくつかのバックエンドのもののためZapierとPythoneverywhereを使用してきた、と次のように最近、私は534エラーを取得してきた:ZapierとPythoneverywhere SMTPの問題は

File "/usr/lib64/python2.7/smtplib.py", line 622, in login raise SMTPAuthenticationError(code, resp) SMTPAuthenticationError: (534, '5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbuE\n5.7.14 VyQLZTijmufE25PUD9vfTLC3FrnAU5nlNWptaIGEMv5N2OJ6SeJr1k1LxC0yuXv1eZAMYw\n5.7.14 ejmvetuDKIBX3L9MYPGLY75EUlIuSiSHEmp-0wpi6gazhumwltHXV07K9Q0lou0t4ky1QN\n5.7.14 7jnbEIhA1W6ceSVqvdwtH7wAOKsUhDlwYhkd3-81UClaoJ7sWRCICCJJW4iQxpIDNE4Yqr\n5.7.14 Tto1BfHEYh77B5bZkRiu5BxvjOfCY> Please log in via your web browser and\n5.7.14 then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/answer/78754 t1sm124763qtt.25 - gsmtp'"

私はかなり確信しています私は何ヶ月も使っているので、コードに問題はありません。私は良い測定のためにいくつかのテストコードを投稿しますが、実際には他の誰かがエラーを出しているのか、解決策を見つけたのか不思議です。

import smtplib 
    from email.MIMEMultipart import MIMEMultipart 
    from email.MIMEText import MIMEText 
    company = 'daves burgers' 
    dealtype = '409a' 
    analyst = 'Nate' 
    itemId = '92081920' 
    salesRep = 'shawn olsen' 
    companyLink = 'html link to company' 
    analystFirst = (analyst.split(' ',2))[0] 
    salesRepFirst = (salesRep.split(' ',2))[0] 
    contactEmail = '[email protected]' 
    analystEmail = "[email protected]" 
    emailPass = "password" 
    html = """<html>A bunch of html></html>""" 
    fromaddr = analystEmail 
    bcc = ['[email protected]'] 
    firstName= 'dave' 
    msg = MIMEMultipart() 
    msg['From'] = analyst 
    msg['Subject'] ="Scalar - "+company+" - "+dealtype+" - onboarding" 
    body = "Thanks "+salesRepFirst+".\n\n"+firstName+",\n\nPleased to e-meet you. We're looking forward to working on your valuation! To begin the onboarding process, please follow this link (link to onboarding "+companyLink+"/"+itemId+") to our onboarding platform, where you will be asked to verify information about your company as well as provide the necessary documentation for the valuation to begin. Should any questions arise while you're gathering the necessary docs, please reach out to me.\n\nOnce we receive the docs, we'll get started right away and will turn around the draft within 5-7 business days. We'll most likely want to set up a call with you once we've started the analysis. I'll reach out to you at that point.\n\nThanks!" 
    msg['To'] = contactEmail 
    toaddr = contactEmail 
    toaddrs = [toaddr] + bcc 
    msg.attach(MIMEText(body, 'plain')) 
    msg.attach(MIMEText(html,'html')) 
    server = smtplib.SMTP('smtp.gmail.com',587) 
    server.ehlo() 
    server.starttls() 
    server.login(analystEmail,emailPass) 
    text = msg.as_string() 
    server.sendmail(fromaddr, toaddr, text) 

このエラーは、私がZapierまたはPythonanywhereからにログインし、電子メールアカウントに関係なく発生する(また、注目に値するは、すべてのアカウントが設定で許可さ「安全性の低いアプリケーションを」持っているということです)。 (このあたりとして

server.ehlo() 
    server.starttls() 
    server.ehlo() 

答えて

1

、これはそれを修正し、なぜ私はわからないんだけど、私はこのコードのセクションに1つの変更を行った:

server.ehlo() 
    server.starttls() 

となるためにそれを変更しましたError Sending Email (Gmail) Via Python 2.6)フォーラムの投稿。

関連する問題