I have a sketch that I have a bunch of error checking in, and if a flag is set, I want to be notified via email. I have searched for a while, and every link comes up dead from 2016 and before. I have not found any topics related to this since. There is one for Mac, but I have a PC, and there is also another one that you have to sign up for a temboo acount (https://temboo.com/processing/send-email) but I would rather not use that app as I have never heard of it. I am hoping there is some library or command that I can log into a gmail account, and have that send an email to my main account. Has anyone done this before?
Processing is built on top of Java, so if you can’t find a Processing library that does what you want, you can always look for a Java solution.
Googling “java send email” or “java send gmail” returns a ton of results that seem pretty promising.
Looks like Shifftman made an example back in 2007 - https://shiffman.net/blog/email/java/p5/processing.org/2007/11/13/e-mail-processing/,
But the JavaMail library is out of date. Here is the latest version - https://javaee.github.io/javamail/#Download_JavaMail_Release
Good luck, hope this helps
Keep in mind when using gmail, you have to lower some security setting. I forgot what it was named.
I have tried multiple examples, and the one linked from 2007 is my best bet so far, but every time I try to run it, I get “Cannot find a class or type named “Properties””
Has anyone else tried this example? I also updated the javamail library. I will try going through the readme as well.
What is your underlying operating system?
Are you trying to send it via an account you control on a remote server, e.g. a POP3 or IMAP account? Or are you trying to use your computer as a mail server?
Perhaps (untested) you could also use a service to generate the message directly – for example, IFTTT.
If you already have a full mail server running on your machine, you could also use exec() or run() to send the mail from the command line. However a public url to a third-party service will be more robust in that your sketch will be able to send the message no matter what computer it is running on as long as it has an internet connection – no changes to security settings etc needed. By contrast, trying to originate mail from your own mail server can have a lot of points of failure depending on your internet connection / service.
I am running windows 10 on a pc.
I am trying to run processing to send an email if “X” condition has been met by my program.
I don’t know much about the internet processes I am trying to access.
So I finally got the code to verify and run, but I had to add
to the code, and update all the libraries.
That being said, I could not log into google because google blocked me from logging into a test gmail account I made for my purposes.
The full errors I got are
javax.mail.AuthenticationFailedException: [AUTH] Web login required: https://support.google.com/mail/answer/78754
com.sun.mail.util.MailConnectException: Couldn’t connect to host, port: localhost, 25; timeout -1;
nested exception is:
java.net.ConnectException: Connection refused: connect
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
… 11 more
In addition, I got an email from google saying that they blocked somebody from logging into my account using my same password. I can’t find anywhere on google how to allow this connection. It keeps asking me to create a google API console, and this is currently beyond me. Is there just some sort of permissions button I can turn off to allow java log in?
Thank you again for your help.
Edit: I found the allow less secure apps page here
But I am still running into the same errors.
Edit2: Got it working!!!
Had to allow less secure apps on the website above, AND AND AND another less secure app access here
Works great! Thanks for everyones help!
Hey, I know it’s been a while, but could you share some skeleton example of the code you used that works? Also, how to setup the sketch? I’m new to using straight-up Java in Processing and could use a couple of hand-holds. My sketch needs to send an email with an attached file when a user inputs their email address into a text field. I got the text field email acquisition figured out, but any further shortcuts to getting all the pieces in the right place will be nice.