So I’m trying to retrieve a still image from a camera and email it… Should be easy, right?
mail wiki says:
sendMail(String to, String subject, String message, String attachmentUrl): Sends an email with attachment via SMTP.
Seems easy enough. A static jpg gets emailed pretty easily:
Problem happens when the url is of the form:
Winds up with an invalid url message:
2016-03-28 21:42:58.372 [ERROR] [nhab.action.mail.internal.Mail] - Error adding attachment to email. org.apache.commons.mail.EmailException: Invalid URL set:http://(redacted):(redacted)@(redacted)/image/jpeg.cgi
Seems like I should be able to do a two-step method, by manually retrieving the image with sendHttpGetRequest, store it in a string, then pass the string as the attachment. Sadly, either I don’t understand how to do that or it doesn’t work either:
var String http_response http_response = sendHttpGetRequest("http://(redacted):(redacted)@(redacted)/image/jpeg.cgi") sendMail("firstname.lastname@example.org","test email subject","message body.",http_response)
2016-03-28 21:47:10.590 [ERROR] [nhab.action.mail.internal.Mail] - Invalid attachment url. java.net.MalformedURLException: no protocol: ???? ►JFIF ?? C ♠♦♣♠♣♦♠♠♣♠♠ (rest of binary jpeg data clipped)
Any suggestions on how to accomplish this?