|
|
|
It is currently Sat May 18, 2013 8:28 am
|
View unanswered posts | View active topics | View unsolved topics
|
Page 1 of 1
|
[ 6 posts ] |
|
| Author |
Message |
|
gviscarret
Cadet
Joined: Tue Apr 10, 2012 11:41 pm Posts: 1
|
 Reading Email
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?
|
| Sun May 20, 2012 11:17 pm |
|
 |
|
Travis.Cox
Moderator
Joined: Sun Apr 02, 2006 2:46 pm Posts: 1974 Location: Sacramento, CA
|
 Re: Reading Email
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') 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()
_________________ Travis Cox
Inductive Automation
Technical Support Rep.
|
| Mon May 21, 2012 7:09 am |
|
 |
|
tailfire
General
Joined: Thu Jan 26, 2012 5:18 pm Posts: 185
|
 Re: Reading Email
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.
|
| Thu Sep 20, 2012 5:24 pm |
|
 |
|
James.Lorenz
Moderator
Joined: Mon Jun 04, 2012 8:53 am Posts: 402
|
 Re: Reading Email
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?
_________________ James Lorenz QA/Build Engineer Inductive Automation
|
| Mon Sep 24, 2012 3:35 pm |
|
 |
|
tailfire
General
Joined: Thu Jan 26, 2012 5:18 pm Posts: 185
|
 Re: Reading Email
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....
|
| Mon Sep 24, 2012 3:45 pm |
|
 |
|
James.Lorenz
Moderator
Joined: Mon Jun 04, 2012 8:53 am Posts: 402
|
 Re: Reading Email
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.
_________________ James Lorenz QA/Build Engineer Inductive Automation
|
| Mon Sep 24, 2012 3:49 pm |
|
 |
|
|
Page 1 of 1
|
[ 6 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|