Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2019
729
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.62 KB | None | 0 0
  1. import string
  2. import smtplib
  3. from email.mime.multipart import MIMEMultipart
  4. from email.mime.text import MIMEText
  5. from email.mime.application import MIMEApplication
  6.  
  7. print("Email-every-person-in-file Script")
  8. print("----------------------\n")
  9.  
  10. from_email = "racinecountyeyenews@gmail.com"
  11.  
  12. def SendMail(to_email):
  13. #Authenticate to Gmail's SMTP Protocol
  14. #server = smtplib.SMTP('smtp.gmail.com', 587)
  15. #server.starttls()
  16.  
  17. #Encrypt (Encode) Password to avoid plain-text exposure
  18. #server.login(("racinecountyeyenews@gmail.com"), ("RacineCountyEye123!"))
  19.  
  20. # Create a text/plain message
  21. msg = MIMEMultipart('alternative')
  22. msg['Subject'] = 'Just following up'
  23. msg['From'] = from_email
  24. msg['To'] = to_email
  25.  
  26. # Attaching the html
  27. html = """\
  28. <html><head></head><body><p>Hey there!<br /><br />Great website and I hope you guys are staying warm over there. This weather has truly been something fierce. I&rsquo;d just like to introduce myself and offer to be at service to you in any way I can.<br /><br />My name is Alex Ebinal and I work with Racine County Eye news. We are well known in the southeast wisconsin area and have been working with construction employers for over 20 years to solve the biggest problems they face as pain free as possible.<br /><br />I know you must get a lot of emails like this. That&rsquo;s why the last thing I want to do is be one more person that wastes your time. I would like to learn about your company and your biggest needs right now. If we have something that could be of use to you, I&rsquo;d love to be the one to solve that problem for you.<br /><br /><br /><strong><br /></strong>If you have a minute, which of the following problems has been most relevant right now in your business? If you&rsquo;re busy, please feel free to simply respond with a number. I will get back to you as soon as I can. Day or Night.<strong><br /></strong><strong><br /></strong><strong>1) Difficulty finding Skilled Workers</strong><strong><br /></strong><strong>2) High Turnover Costs</strong><strong><br /></strong><strong>3) Finding Effective Advertising</strong><br /><br /><br /><br /><i>Stay Warm!</i><br /><br /></p><p>Alex Ebinal, Customer Relations &amp; Business Development</p><p>Phone Number: (262) 770-5175</p><p>CEO Denise Lockwood: (262) 504-9570<br /><br /></p><p>Email: racinecountyeyenews@gmail.com</p><p>Website: <a href="https://racinecountyeye.com/">https://racinecountyeye.com</a></p><p><a href="https://jobs.racinecountyeye.com/">Southeast Wisconsin Job Board</a> | <a href="https://jobs.racinecountyeye.com/products">Post a Job</a><br /><br /></p><img src="https://lh4.googleusercontent.com/cMe1UvyguVslPKkrgYBraniFqOc-gKu5MHjZG_7VMMPJuVk82drGPjIWtnl2ruJDTwiA1zESoJZZFZu_MINoso7VRZLhMieVxwBbIyH_HOhC5h_nmGbsNcgTt1XwcKNAjhkNp0k" alt="RCE" width="102" height="87"></p></span></div></body></html>"""
  29.  
  30. # The main body is just another attachment
  31. #body = email.mime.Text.MIMEText("""Test body...""")
  32. part = MIMEText(html, 'html')
  33. msg.attach(part)
  34.  
  35. ###### [COMMENT THE FOLLOW TO NOT INCLUDE ATTACHMENT] ###
  36. #filename='More_Information.pdf'
  37. #fp=open(filename,'rb')
  38. #att = MIMEApplication(fp.read(),_subtype="pdf")
  39. #fp.close()
  40. #att.add_header('Content-Disposition','attachment',filename=filename)
  41. #msg.attach(att)
  42. ######
  43.  
  44. #Login
  45. s = smtplib.SMTP('smtp.gmail.com')
  46. s.starttls()
  47. s.login(from_email,'RacineCountyEye123!')
  48. s.sendmail(from_email,[to_email], msg.as_string())
  49. s.quit()
  50.  
  51. fh = open('/home/ubuntu/Cannon/Business2.txt')
  52. for line in fh:
  53. SendMail(line)
  54. fh.close()
  55.  
  56. print('Script ended successfully!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement