Advertisement
Guest User

Untitled

a guest
Feb 17th, 2016
8,305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. from sendemail import SendEmail # uses smtplib, socket
  2. from getheaders import GetHeaders # uses imaplib, email
  3. from printoutput import PrintOutput # uses email.utils, pytz, datetime, time
  4.  
  5.  
  6. send_email = SendEmail()
  7. send_email.config_connection(host='smtp.zoho.com', port=465, user='sending_to_forwarder@zoho.com', password='xxx')
  8. send_email.send(send_to='forwardtooutlook@var.ninja', message='email message, subject is timestamp') # connect and send email, then d/c
  9.  
  10. if send_email.error:
  11. print(send_email.error)
  12. exit() # if senderrefused, socketerror, login error, authentication method error
  13. else:
  14. print('='*20 + '\n' + 'Message Sent' + '\n' + '='*20)
  15.  
  16. get_headers = GetHeaders()
  17. get_headers.config_connection(user='forward_to@outlook.com', port=993, password='xxx', host='imap-mail.outlook.com') # config imap creds
  18.  
  19. print_it = PrintOutput()
  20. print_it.printoutput(get_headers) # pass imap connection object, check server for new messages, parse headers of unseen messages, and print delay summary
  21. # PrintOutput does too much, will refactor
  22.  
  23.  
  24. #Output
  25. """
  26. ====================
  27. Message Sent
  28. ====================
  29. from [192.168.10.1] (50-46-215-239.evrt.wa.frontiernet.net [50.46.215.239]) by mx.zohomail.com
  30. with SMTPS id 1455691781661522.5883961538051; Tue, 16 Feb 2016 22:49:41 -0800 (PST)
  31. --------------------
  32. Delay at this hop: 0:00:00
  33. --------------------
  34. from sender153-mail.zoho.com (unknown [74.201.84.153])
  35. by c1mailgw11.amadis.com (Postfix) with ESMTP id 8E93B9BA1970C
  36. for <forwardtooutlook@var.ninja>; Tue, 16 Feb 2016 22:49:51 -0800 (PST)
  37. --------------------
  38. Delay at this hop: 0:00:10
  39. --------------------
  40. from 38.113.116.221 unverified ([38.113.116.221]) by mwpop05oc.mail2world.com with Mail2World SMTP Server;
  41. Tue, 16 Feb 2016 22:50:51 -0800
  42. --------------------
  43. Delay at this hop: 0:01:00
  44. --------------------
  45. from mail pickup service by mail2world.com with Microsoft SMTPSVC;
  46. Tue, 16 Feb 2016 22:50:54 -0800
  47. --------------------
  48. Delay at this hop: 0:00:03
  49. --------------------
  50. from mail2world.com ([209.67.128.125]) by SNT004-MC3F44.hotmail.com with Microsoft SMTPSVC(7.5.7601.23143);
  51. Tue, 16 Feb 2016 22:50:56 -0800
  52. --------------------
  53. Delay at this hop: 0:00:02
  54. --------------------
  55. from SNT004-MC3F44.hotmail.com (10.152.84.58) by
  56. BY2NAM03FT050.mail.protection.outlook.com (10.152.85.137) with Microsoft SMTP
  57. Server (TLS) id 15.1.415.6 via Frontend Transport; Wed, 17 Feb 2016 06:50:56
  58. +0000
  59. --------------------
  60. Delay at this hop: 0:00:00
  61. --------------------
  62. from BY2NAM03FT050.eop-NAM03.prod.protection.outlook.com
  63. (2a01:111:f400:7e4a::203) by BY2PR04CA0084.outlook.office365.com
  64. (2a01:111:e400:2c16::52) with Microsoft SMTP Server (TLS) id 15.1.409.15 via
  65. Frontend Transport; Wed, 17 Feb 2016 06:50:57 +0000
  66. --------------------
  67. Delay at this hop: 0:00:01
  68. --------------------
  69. from BY2PR04CA0084.namprd04.prod.outlook.com (10.255.247.52) by
  70. BY2PR0401MB0968.namprd04.prod.outlook.com (10.160.64.151) with Microsoft SMTP
  71. Server (TLS) id 15.1.409.15; Wed, 17 Feb 2016 06:50:57 +0000
  72. --------------------
  73. Delay at this hop: 0:00:00
  74. --------------------
  75. from BY2PR0401MB0968.namprd04.prod.outlook.com (10.160.64.151) by
  76. CY1PR0401MB0971.namprd04.prod.outlook.com (10.160.160.17) with Microsoft SMTP
  77. Server (TLS) id 15.1.403.16 via Mailbox Transport; Wed, 17 Feb 2016 06:50:57
  78. +0000
  79. --------------------
  80. Delay at this hop: 0:00:00
  81. --------------------
  82. ++++++++++++++++++++
  83. Total time to delivery: 0:01:16
  84. ++++++++++++++++++++
  85. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement