Sending Mail via FOCUS HMI Panel

You can send an e-mail in Focus Hmi using the script below. After copying the code and pasting it into the Focus HMI program, you need to correct the quotation marks. To add a file to the mail you send, you must write the file path in the Attachment parameter.

import java.lang.reflect.Method;
public class SendMail{
public static short Tag_2;
public static short Tag_1;
public SendMail(Class Accessing){
try{
String SmtpHost=”mail.fultek.com.tr”;
String Port=”587″;
String UserName=”info @fultek.com.tr”;
String Pass=”*********”;
String From=”info @fultek.com.tr”;
String To=”receiver @fultek.com.tr”;
String Subject=”Test Mail”;
String Text=”Tag Values: ” + Tag_1 + Tag_2;
String Attachment=””; //”c:\\ABC\\FocusHmi\\textfile.txt”
Method sendMail = Accessing.getMethod(“sendMail”, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class);
sendMail.invoke(Accessing, SmtpHost, Port, UserName, Pass, From, To, Subject, Text, Attachment);
}catch(Exception exp){
javax.swing.JOptionPane.showMessageDialog(null , exp.getMessage());
}
}
}

Leave a Reply