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?
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’)
#Get messages from server:
messages = [pop_conn.retr(i) for i in range(1, len(pop_conn.list()) + 1)]
Concat message pieces:
messages = ["\n".join(mssg) for mssg in messages]
#Parse message intom an email object:
messages = [parser.Parser().parsestr(mssg) for mssg in messages]
for message in messages:
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.
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?
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…
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.