May 28, 200817 yr Sending eMails (with or without attachments) ~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~ Unfortunately I'm not very familiar with Java and possibly am missing only two additional lines. Basically every SMTP server today requires authentification for good reason - all of us receive far enough of SPAM. Well, how do I add login name and password to the 360works ScriptMaster SMTP examples? For any answer thanks a lot in advance! Sincerely, Therese
May 29, 200817 yr How about this function in SMTPit? SMTPit_SetAuthentication( Type {; Username {; Password {; UseSSL }}} ) /* Type = The Type of Authentication. [specify "None", "Default", "Plain", "Login", "CRAM-MD5", or "Auto".] Username = Your account Username. Password = Your account Password. UseSSL = Set to True if your mail server requires SSL/TLS/STARTTLS. */
May 30, 200817 yr Author Your're right, it should be something like this -- login with username and password. However I'd like to do it without SMTPit (which of course is a taylored solution for that task) by simply using the correct lines of code within JAVA resp. GroovyScript. As far as I know there are JAVA clients capable of sending mails with authentification, so the question simply is -- how? Which maybe three lines of code are used in Java to do SMTP authentfication? Sincerely, Therese
May 31, 200817 yr Sam knows the Java mail code better than I do, but I did find this code snippet from a google search: http://www.rgagnon.com/javadetails/java-0538.html
May 31, 200817 yr Author Dear Jesse, thanks a lot. I've also got the hint I could have googled myself a bit ;-) The most important lines in the JAVA example you mentioned seem to be to me: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ import javax.mail.Authenticator; import javax.mail.PasswordAuthentication; ... private static final String SMTP_AUTH_USER = "myusername"; private static final String SMTP_AUTH_PWD = "mypwd"; ... props.put("mail.smtp.auth", "true"); Authenticator auth = new SMTPAuthenticator(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ props.put(...) translates to System.setProperty (...) The JAVA authentification module obviously relies on the static variables SMTP_AUTH_USER and SMTP_AUTH_PWD. In a first try I simply copied the lines with private static final String ... into the groovy script -- and got a nice two pages error notification basically stating that groovy script doesn't understand SMTPAuthenticator() (probably part of the javax.mail.Authenticator module). And without this line of course there is a two pages error notification starting with javax.mail.AuthenticationFailedException. I'm going to see whether I can find a debug for the import of the needed classes. Sincerely, Therese
March 12, 201510 yr I tried to use Sending Mail with Auntethication using scriptmaster, but through a MANDRIL server smtp............ Cannot do it because Mandril use another port 587 ( i think ), different from 25 port. Any idea to fix that ? thanks a lot.
March 12, 201510 yr you should be able to set the port by doing props.setProperty("mail.smtp.port", 587), before the initialization of the MimeMessage. On a sidenote, it's generally considered bad form to dig up years-old topics like this. It's good to do research (in finding these topics), but if you have a different question, it's better to start your own topic.
March 12, 201510 yr four steps with newer javax code implementation at start props = new Properties() props.setProperty('mail.smtp.auth', 'true') props.setProperty('mail.smtp.timeout', 1000) then make the msg PORT is an integer with your port number using javamail 1.5 transport = Session.getDefaultInstance(props).getTransport('smtp') transport.connect(HOST, PORT, username, password) transport.sendMessage(msg, msg.getAllRecipients()) transport.close() good place to start will be the examples on the api page https://java.net/projects/javamail/pages/Home
Create an account or sign in to comment