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

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

Recommended Posts

Posted

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

Posted

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.

Posted

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

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
Posted

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.

This topic is 4961 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.