Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Sending eMails with ScriptMaster

Featured Replies

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

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.

*/

  • 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

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

  • 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

  • 6 years later...

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.

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.

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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.