Tag Archive: email

After configuring the JNIOR properly, a way to send an email from it is to use the MailComposer class. This function has the user define the email being sent by building different parts of the email (Email address being sent to, Attachments to add, anyone that needs CC’d, subject, message, etc). Once these are all defined, you can use the MailComposer’s send() function to submit the email.

package emailexample;

import com.integpg.system.JANOS;
import com.integpg.system.MailComposer;

public class EmailExample {

    public static MailComposer mail = new MailComposer();
    
    public static void main(String[] args) {
        
        mail.setToAddress("YOUR EMAIL HERE");
        mail.setSubject("MailComposer Test");
        mail.setMessage("This was built and sent using the MailComposer Class.");
        mail.send();
        
    }
    
}

I put the built jar file of this example application into the JNIOR’s flash folder and ran it from the Web UI’s console tab. After it had successfully run, I checked my email and received one from the MailComposer example.

After configuring the JNIOR properly, a way to send an email from it is to use the JANOS.sendmail() function. The .sendmail() function needs the name of a mail profile on the JNIOR that you defined earlier, the subject of the email, and the email’s message.

package emailexample;

import com.integpg.system.JANOS;
import com.integpg.system.MailComposer;

public class EmailExample {

    public static MailComposer mail = new MailComposer();
    
    public static void main(String[] args) {
        
        JANOS.sendMail("YOUR EMAIL-PROFILE HERE", "EmailExample", "This was built and sent from the JANOS class.");

    }
    
}

I put the built jar file of this example application into the JNIOR’s flash folder and ran it from the Web UI’s console tab. After it has successfully run, I check my email and have received one from the JANOS.sendmail() example.

When creating an application, being able to send emails from it may be something a User wants to do. JNIORs have email blocks in their configuration that can be setup to send emails.

Setting Up JNIOR Email

To properly setup an email for the JNIOR to use, you’ll want to use the JNIOR’s Web UI and navigate to the Email Account section under Configuration. Here you’ll want to include the Mail Server, From Address, and SMTP Username your JNIOR will use to send the email. These are required in order to send emails from the JNIOR.

Next, in the Network section you’ll want to make sure you have a DNS Address declared. For our examples we use 8.8.8.8, which is Google’s.

Lastly, we’ll want to make sure we give the address we are sending to to the Mail-Profiles section. Only a ToAddress is needed, but additional information can be entered to be used as a default. This is used for the JANOS.sendmail() class.

Now that this is setup, we can now create an application that can use these settings to send an email. The following example shows two different ways that an email can be sent from an application. The first way uses the JANOS class, and the other uses the MailComposer class.

View on GitHub

I put the built jar file of this example application into the JNIOR’s flash folder and ran it from the Web UI’s console tab. Once its run an email should be sent to the address, subject, and message you declared.