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.

How to install/use a sm script ?

Featured Replies

Hi,

The subject is telling it: im a newbie. I've been working with fm since a couple of weeks and i want to use the "send email with authentication" script in fm (i just want to email some lists and i cant find a way to do that in rows not using html).

The thing is that i cant understand how to install this script.

I dont even know what to do with the text on the first page that starts like this:

[color:green]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");

and im not even sure if the "COPY" option is the best for me to choose and where should i copy it.

this forum has been really helpfull... and ive been trying not to post but thisone is too out of my current understanding of fm and i just cant figured it out. any help/leads will be appreciated.

(finally.. sorry about my english!)

I've posted a video showing how to do this on Youtube. The interface will look a little bit different than the one you have; we're getting ready to release a new version with a nicer UI and this video shows that.

  • Author

that was really really helpfull, thanks a lot !

Im having problems registering "Send Email With Authentication" script using the "Copy" function. I just cant get it registered.

I've tried it with other scripts and it works fine, i guess there's something wrong with this particular script ?

The function gets registered if i write this in the set field variable:

[color:green]RegisterGroovy( "SendEmailWithAuthentication( from ; to ; subject ; htmlBody ; attachmentPath ; smtpHost ; username ; password )" ; "something")

but if instead of [color:green]"something" i write the actual script that its automatically copied it just doesnt work.

here it is in case you want to take a look at it:

[color:green]RegisterGroovy( "SendEmailWithAuthentication( from ; to ; subject ; htmlBody ; attachmentPath ; smtpHost ; username ; password )" ; "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));¶

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" )

Thanks again for your help !

  • 2 weeks later...
  • Author

ok... i've been trying harder and i've found out that there are some lines that makes the problem.

to make it clear, i can register the function if i remove the lines in [color:blue]blue (but off course the function doesnt work). If i leave one of them then the function is not registered:

[color:green]RegisterGroovy( "SendEmailWithAttachments( from ; to ; subject ; body ; smtpHost ; attachmentPath )" ; "import javax.mail.*;¶

import javax.mail.internet.*;¶

Properties props = new Properties();¶

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

[color:blue]MimeMessage msg = new MimeMessage(Session.getDefaultInstance(props));¶

Multipart content = new MimeMultipart();¶

// first the message body¶

[color:blue]MimeBodyPart bodyPart = new MimeBodyPart();¶

bodyPart.setText(body);¶

content.addBodyPart(bodyPart);¶

// then the attachment¶

[color:blue]MimeBodyPart attachmentPart = new MimeBodyPart();¶

attachmentPart.attachFile(attachmentPath);¶

content.addBodyPart(attachmentPart);¶

msg.setContent(content);¶

msg.setSubject(subject);¶

msg.setFrom(new InternetAddress(from));¶

[color:blue]msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));¶

Transport.send(msg);¶

return true" )

this is as far as i can go... i dont know anything of groovy nor java, so any help will be much appreciated.

  • 1 year later...
  • Newbies

ok... i've been trying harder and i've found out that there are some lines that makes the problem.

to make it clear, i can register the function if i remove the lines in [color:blue]blue (but off course the function doesnt work). If i leave one of them then the function is not registered:

...

this is as far as i can go... i dont know anything of groovy nor java, so any help will be much appreciated.

Just need to follow all instructions.

For this particular function, you need two JAR files: mail.jar and activation.jar, in order to load them you need to use the function SMLoadJar( externalJar )

This function works terrific and is free.

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.