# Reading Email

**URL:** <https://forum.inductiveautomation.com/t/reading-email/4501>\
**Category:** General Discussion\
**Created:** [May 21, 2012, 7:17am UTC](https://forum.inductiveautomation.com/t/reading-email/4501 "2012-05-21T07:17:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gviscarret](https://avatars.discourse-cdn.com/v4/letter/g/e0b2c6/32.png) [@gviscarret](https://forum.inductiveautomation.com/u/gviscarret)\
**Post date:** [May 21, 2012, 7:17am UTC](https://forum.inductiveautomation.com/t/reading-email/4501/1 "2012-05-21T07:17:20Z")

</div>

Hi  
I know Ignition has the function to sending emails (system.net.sendEmail) but, what about reading emails?  
How can be the way for reading emails?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [May 21, 2012, 3:09pm UTC](https://forum.inductiveautomation.com/t/reading-email/4501/2 "2012-05-21T15:09:05Z")

</div>

We don’t include JavaMail library in Ignition to read emails. However, you can use Python’s email library as of Ignition 7.4. Here is an example:[code]import poplib  
from email import parser

pop\_conn = poplib.POP3\_SSL(‘[pop.gmail.com](http://pop.gmail.com)’)  
pop\_conn.user(‘username’)  
pop\_conn.pass\_(‘password’)  
#Get messages from server:  
messages = [pop\_conn.retr(i) for i in range(1, len(pop\_conn.list()[1]) + 1)]

# Concat message pieces:

messages = ["\n".join(mssg[1]) for mssg in messages]  
#Parse message intom an email object:  
messages = [parser.Parser().parsestr(mssg) for mssg in messages]  
for message in messages:  
print message[‘subject’]  
pop\_conn.quit()[/code]

---

<div class="post-metadata">

**Author:** ![tailfire](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@tailfire](https://forum.inductiveautomation.com/u/tailfire)\
**Post date:** [September 21, 2012, 1:24am UTC](https://forum.inductiveautomation.com/t/reading-email/4501/3 "2012-09-21T01:24:31Z")

</div>

Are there any generic example screens of this? I would like to do a generic screen where the user inputs the to from subject and body of the message to send. I have not done this yet but a potential problem would be the security of the from field. I wasnot sure how to just leave this blank. I would almost rather this be a `messenger` type screen.

---

<div class="post-metadata">

**Author:** ![James.Lorenz](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/james.lorenz/32/3290_2.png) [@James.Lorenz](https://forum.inductiveautomation.com/u/James.Lorenz)\
**Post date:** [September 24, 2012, 11:35pm UTC](https://forum.inductiveautomation.com/t/reading-email/4501/4 "2012-09-24T23:35:17Z")

</div>

It’s not an e-mail example, but there is a popup screen in the most recent demo project that allows a user to enter in data into a form, and submit the data to a database. I think your use case is similar; get data from the user, and then use system.net.sendEmail() to send off the e-mail. What is your security concern with the from field? Does the smtp server not use authentication?

---

<div class="post-metadata">

**Author:** ![tailfire](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@tailfire](https://forum.inductiveautomation.com/u/tailfire)\
**Post date:** [September 24, 2012, 11:45pm UTC](https://forum.inductiveautomation.com/t/reading-email/4501/5 "2012-09-24T23:45:35Z")

</div>

my main concern was the " human factor" to put it nicely. after further thought it would be trackable and even a  
useable field and that is who was logged in. horseplay was my concern. sending messages from someone who  
was not genuinely the author…

---

<div class="post-metadata">

**Author:** ![James.Lorenz](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/james.lorenz/32/3290_2.png) [@James.Lorenz](https://forum.inductiveautomation.com/u/James.Lorenz)\
**Post date:** [September 24, 2012, 11:49pm UTC](https://forum.inductiveautomation.com/t/reading-email/4501/6 "2012-09-24T23:49:17Z")

</div>

Yeah, definitely don’t want malicious e-mails. But that’s why I asked about authentication - if the smtp server requires a user/password, that would thwart the obvious issues. If it doesn’t, then you would get user info via scripting or a client tag, and not let the user have the “from” option.

---

<div class="post-metadata">

**Author:** ![Raphael\_Hassler](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@Raphael\_Hassler](https://forum.inductiveautomation.com/u/Raphael_Hassler)\
**Post date:** [February 28, 2023, 9:55am UTC](https://forum.inductiveautomation.com/t/reading-email/4501/7 "2023-02-28T09:55:47Z")

</div>

Hi,  
Is there a way to read incoming email with mailbox that need OAuth2 (as office 365 in my case) ?
