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.

SendEmailWithAuthentication only working intermittantly

Featured Replies

My goal is to get the SendEmailWithAuthentication to work within IWP.

I am running FMP Adv Server 9.0.3.325 on a iMac G5 running Mac OS 10.4.11 and Java version 1.5.0.13.

So far, it's worked successfully approximately 3 out of 50 tries. Not sure what the problem is. It was working consistantly within the FMP client, but now that has stopped working for me as well.

While in IWP I get the ERROR result and the message:

javax.mail.NoSuchProviderException: smtp

Parameters:

{}

---Script---

I've checked the logs and I see a lot of instances of this (private info replaced with "X"s )...

Oct 16, 2008 3:51:32 PM com.prosc.beanshell.BeanShellPlugin SMLoadJar

INFO: Loaded external lib at file:/tmp/ScriptMaster/ScriptMaster55330mail.jar

Oct 16, 2008 3:51:32 PM com.prosc.beanshell.BeanShellPlugin SMLoadJar

INFO: Loaded external lib at file:/tmp/ScriptMaster/ScriptMaster55331activation.jar

Oct 16, 2008 3:51:32 PM com.prosc.beanshell.BeanShellPlugin RegisterGroovy

INFO: Registering function 'SendEmailWithAuthentication( from ; to ; subject ; htmlBody ; attachmentPath ; smtpHost ; username ; password )'

Oct 16, 2008 3:51:33 PM com.prosc.fmkit.PluginBridge registerFunction

WARNING: *** WARNING: function SendEmailWithAuthentication with ID 23762 conflicts with the function ID for SendEmailWithAuthentication. SendEmailWithAuthentication will not appear in the function list.

Oct 16, 2008 3:51:42 PM com.prosc.fmkit.Plugin setLastError

SEVERE: PluginFunction com.prosc.beanshell.GroovyFunction@6a0df6 got an error with converted args [[email protected], [email protected], Greetings, Hello There!, null, smtp.XXXX.com, userXXXX, passXXXX]

javax.mail.NoSuchProviderException: smtp

at javax.mail.Session.getService(Session.java:782)

at javax.mail.Session.getTransport(Session.java:708)

at javax.mail.Session.getTransport(Session.java:651)

at javax.mail.Session.getTransport(Session.java:631)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)

at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)

at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:899)

at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:740)

at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:765)

at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:753)

at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)

at Script1.run(Script1.groovy:27)

at com.prosc.beanshell.GroovyFunction.invoke(GroovyFunction.java:122)

at com.prosc.fmkit.Plugin.invokeFunction(Plugin.java:237)

at com.prosc.fmkit.Plugin.invokeFunctionNoErrors(Plugin.java:221)

at com.prosc.fmkit.PluginBridge$3.run(PluginBridge.java:886)

at com.prosc.fmkit.PluginBridge.runTask(PluginBridge.java:945)

at com.prosc.fmkit.PluginBridge.doFunction(PluginBridge.java:902)

It appears to be saying that I've registered the SendEmailWithAuthentication function multiple times, but I haven't. and I did include the SMReset command before loading the jar files--though I would think that would generate a different error.

Any idea what's going on here?

  • Author

To test the functionality, I created my own 'SendEmail' custom function in FMP Advanced that passes parameters to an EvaluateGroovy function rather than trying to register the SendEmailWithAuthentication function.

And it's working consistantly so far, I just sent about two dozen emails after repeatedly logging in and re-loging into FMP & IWP sessions.

So I'm wondering wether there's something wrong with the RegisterGroovy external command? Just a guess as I haven't used the RegisterGroovy function much before...

  • Author

Also, does anyone know how to use ScriptMaster to send to multiple email recipients? I don't see any documentation how, and I don't really know java. I was expecting to be able to provide a delimited string. I've tried commas, semicolons, returns, spaces. Nothing seems to work...

  • 2 weeks later...

It looks like the critical line in the stack trace is this:

javax.mail.NoSuchProviderException: smtp

Somehow, the right smtp server is not being set.

  • 3 weeks later...
  • Author

It looks like the critical line in the stack trace is this:

javax.mail.NoSuchProviderException: smtp

Somehow, the right smtp server is not being set.

Hmmm. Any idea why? I did provide the correct smtp server info. In the mean time, I'm just using this custom function (which works dependably)B)


/*

SendEmail ( from , to , Subject , Body )

*/



SMSetVariable( "from" ; from ) &

SMSetVariable( "to" ; to ) &

SMSetVariable( "subject" ; Subject ) &

SMSetVariable( "htmlBody" ; Body ) &

SMSetVariable( "attachmentPath" ; "" ) &

SMSetVariable( "smtpHost" ; "smtp.XXXX.com" ) &

SMSetVariable( "username" ; "XXXX" ) &

SMSetVariable( "password" ; "XXXX" ) &



EvaluateGroovy(  

"import javax.mail.*;¶

import javax.mail.internet.*;¶

¶

Properties props = new Properties();¶

props.setProperty("mail.smtp.host", smtpHost);¶

props.setProperty("mail.smtp.auth", "true");¶

props.setProperty("mail.smtps.auth", "true");¶

¶

¶

MimeMessage msg = new MimeMessage(Session.getDefaultInstance(props));¶

Multipart content = new MimeMultipart();¶

¶

// first the message body¶

MimeBodyPart bodyPart = new MimeBodyPart();¶

bodyPart.setContent(htmlBody, "text/html");¶

content.addBodyPart(bodyPart);¶

¶

// then the attachment¶

if (attachmentPath) {¶

	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));¶

msg.setRecipient(Message.RecipientType.CC, new InternetAddress(to));¶

¶

Transport transport = Session.getDefaultInstance(props).getTransport("smtp");¶

int port = -1; // use the default port¶

transport.connect(smtpHost, port, username, password);¶

transport.sendMessage(msg, msg.getAllRecipients());¶

transport.close();¶

return true" 

)

Also, would anyone be able to provide an example of how to send email to a varioable number of recipients? Passing a delimited list of email addresses does not work. Any examples or advice would be greatly appreciated!

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.