Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

SendEmailWithAuthentication only working intermittantly


This topic is 5865 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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?

Posted

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...

Posted

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...
Posted

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.

  • Like 1
  • 3 weeks later...
Posted

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!

This topic is 5865 days old. Please don't post here. Open a new topic instead.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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