How to send saved frames as attachments with processing's JAVAMAIL library?

edited March 2015 in Library Questions

Hey guys so I got this so far, the website is there, also this is from:

So how would I include my saved frames, that are in my data folder? I just want to send the whole folder, but I do not know what to do. When I do the code below, i get:

javax.mail.MessagingException: IOException while sending message; nested exception is: c:\image.jpg.jpg (The system cannot find the file specified) at com.sun.mail.smtp.SMTPTransport.sendMessage( at javax.mail.Transport.send0( at javax.mail.Transport.send( at Email.sendMail( at Email.setup( at processing.core.PApplet.handleDraw( at processing.core.PGraphicsJava2D.requestDraw( at at Source) Caused by: c:\image.jpg.jpg (The system cannot find the file specified) at Method) at Source) at javax.activation.FileDataSource.getInputStream(Unknown Source) at javax.activation.DataHandler.writeTo(Unknown Source) at javax.mail.internet.MimeBodyPart.writeTo( at javax.mail.internet.MimeBodyPart.writeTo( at javax.mail.internet.MimeMultipart.writeTo( at com.sun.mail.handlers.multipart_mixed.writeTo( at javax.activation.ObjectDataContentHandler.writeTo(Unknown Source) at javax.activation.DataHandler.writeTo(Unknown Source) at javax.mail.internet.MimeBodyPart.writeTo( at javax.mail.internet.MimeMessage.writeTo( at com.sun.mail.smtp.SMTPTransport.sendMessage( ... 8 more

So please help me on what I need to do. Thanks in advance: |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv CODE BELOW vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

// Daniel Shiffman

                                            // Example functions that send mail (smtp)
                                            // You can also do imap, but that's not included here

                                            // A function to check a mail account

                                            // A function to send mail
                                            void sendMail() {
                                              // Create a session
                                              String host="";
                                              Properties props=new Properties();

                                              // SMTP Session
                                              props.put("mail.transport.protocol", "smtp");
                                              props.put("", host);
                                              props.put("mail.smtp.port", "587");
                                              props.put("mail.smtp.auth", "true");
                                              // We need TTLS, which gmail requires

                                              // Create a session
                                              Session session = Session.getDefaultInstance(props, new Auth());

                                                MimeMessage msg=new MimeMessage(session);
                                                msg.setFrom(new InternetAddress("", "Name"));
                                                msg.addRecipient(Message.RecipientType.TO,new InternetAddress(""));
                                                msg.setSubject("Email with Processing");
                                                BodyPart messageBodyPart = new MimeBodyPart();
                                             // Fill the message
                                                messageBodyPart.setText("Email sent with Processing");
                                                Multipart multipart = new MimeMultipart();
                                               // Part two is attachment
                                                messageBodyPart = new MimeBodyPart();
                                                DataSource source = new FileDataSource("c:\\image.jpg");
                                                messageBodyPart.setDataHandler(new DataHandler(source));
                                                msg.setSentDate(new Date());
                                                println("Mail sent!");
                                              catch(Exception e)
                                                println("this is the problem:");



Sign In or Register to comment.