为了账号安全,请及时绑定邮箱和手机立即绑定

Python 问题,使用不同的模板发送批量电子邮件?

Python 问题,使用不同的模板发送批量电子邮件?

守候你守候我 2021-09-28 20:38:01
我正在尝试使用 Python 自动化我的冷电子邮件销售流程。我基本上想把一堆信息放到一个谷歌表中。Google 表格中的列值为姓名、电子邮件、公司、跟进、新闻项目。来自以下值的跟进(试图找出一种跟踪跟进数量的方法):是,#1,#2,否我能够从 Google 表格中读取数据,并且能够发送电子邮件。这是谷歌表`。这是我的代码:import csvimport smtplibimport gspreadimport pandas as pdimport pprintfrom oauth2client.service_account import ServiceAccountCredentialsfrom emailsettings import USERNAME, PASSWORDfrom email.mime.text import MIMETextfrom email.mime.multipart import MIMEMultipartscope = ['https://spreadsheets.google.com/feeds','https://www.googleapis.com/auth/drive']creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)client = gspread.authorize(creds)sheets = client.open('Example').sheet1sh = client.open_by_url('https://docs.google.com/spreadsheets/d/1RkzEkCJ4kEbdsW4-LqyO8bKTKBm9XlXrMp49UxIpotQ/edit#gid=0')sheet = sh.get_worksheet(0)data1 = sheet.get_all_values()smtp = smtplib.SMTP('smtp.gmail.com',port=587,timeout=10)smtp.starttls()smtp.login(USERNAME,PASSWORD)INITIAL_MESSAGE = """Hi {},I came across your name while looking for contacts at {}. Huge fan of your work. I'm a person and I'm the founder and COO of this company. This Company is a full-service internet marketing agency, specializing in social media advertising. We've worked with Fortune 500 Company and many others. I'm reaching out because we've helped several companies with increasing their ROI and wanted to see if you were open to discussing your digital goals for 2019. Would you be open to hop on a quick call? Here's my schedule for the week. Looking forward to hearing from you. Thanks, Name它打印出“公司”并给我这个错误:NameError: name 'subject' is not defined我的目标是用有关电子邮件、个人、公司和新闻项目的信息填充电子表格。填写电子表格并运行脚本后,它将跟踪跟进次数并根据多个可用模板生成电子邮件。我听说通过创建类、方法和属性会更容易,但不确定如何做到这一点。
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 184 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号