Noél Dubau Posted October 6, 2013 Posted October 6, 2013 Good afternoon, I implemented the module present in the demo file of Scriptmaster entitled "Send Email With Attachments". I do not meet problem - excepted a relative slowness via my ISP -smtp.free.fr and the mails are forwarded with their attachment. Yesterday finding me at a friend's home, I changed the smtp in question for that of his ISP (smtp.orange.fr ): and then nothing is transmitted (message and attachment) ! Some forums tell to fix the port to 587 but how in the smtphost field ? Thanks Noël
john renfrew Posted October 6, 2013 Posted October 6, 2013 add props.setProperty('mail.smtp.port', 587) ??
Noél Dubau Posted October 7, 2013 Author Posted October 7, 2013 John I tried as you said (I think) by adding as follows, once with simple quotes, once with double quotes... import javax.mail.*; import javax.mail.internet.*; Properties props = new Properties(); props.setProperty("mail.smtp.host", smtpHost); props.setProperty("mail.smtp.port", 587); MimeMessage msg = new MimeMessage(Session.getInstance(props)); Multipart content = new MimeMultipart(); I have always an error and the text returned is groovy.lang.MissingMethodException: No signature of method: java.util.Properties.setProperty() is applicable for argument types: (java.lang.String, java.lang.Integer) values: [mail.smtp.port, 587] Possible solutions: setProperty(java.lang.String, java.lang.String), getProperty(java.lang.String), getProperty(java.lang.String, java.lang.String), hasProperty(java.lang.String), getProperties() Parameters: {[email protected], [email protected], subject=Envoi avec Cerfa, body=I'm testing the "sending email with attachments" utility in ScriptMaster. Works great! Special characters test: éüîñ, smtpHost=smtp.orange.fr, attachmentPath=/Users/ND/Desktop/codes site PEP83.pdf} ---Script--- Script: import javax.mail.*; import javax.mail.internet.*; Properties props = new Properties(); props.setProperty("mail.smtp.host", smtpHost); props.setProperty("mail.smtp.port", 587); MimeMessage msg = new MimeMessage(Session.getInstance(props)); Multipart content = new MimeMultipart(); // first the message body MimeBodyPart bodyPart = new MimeBodyPart(); bodyPart.setText(body, "UTF-8"); content.addBodyPart(bodyPart); // then the attachment MimeBodyPart attachmentPart = new MimeBodyPart(); attachmentPart.attachFile(attachmentPath); content.addBodyPart(attachmentPart); msg.setContent(content); msg.setSubject(subject); msg.setFrom(new InternetAddress(from)); msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to)); Transport.send(msg); return true And this is not very speaking for me (two years ago java was only an exotic dance for me ) Thanks for help Noël
Noél Dubau Posted October 11, 2013 Author Posted October 11, 2013 Hello ! Finallly I just found my error in the adptation of the script contained in the demo file. I used finally the script with authentification and added the line props.setProperty('mail.smtp.port', 587) replacing 587 by a fm_port_smtp value. If someone needs file contact me. Thanks and have a good week-end Noël
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now