Minor issue I know, but does anyone know if there is a way to change this message to English?
(to recieve this message have Sonicle Assistant setup and in Windows right click on a file and sent to > mail recipient )
Minor issue I know, but does anyone know if there is a way to change this message to English?
(to recieve this message have Sonicle Assistant setup and in Windows right click on a file and sent to > mail recipient )
Can someone share a link to the source code for the Neth Server Sonicle Assistant ?
For what it’s worth: it’s Italian, not spanish.
I know, it doesn’t help the problem. Sorry.
Thanks for the heads up…
Hay Michael, have you ever seen to source code posted at Github anywhere ?
Never looked for it => IDK where it is.
Maybe,the assistant is not open source.
Thank you for using it @markareait!
As fare as I know, there is no internationalization support for the assistant.
But @lucag is looking into it.
I guess so, but I will let you know if I find more info.
In the meanwhile, you can find the source code of the project here: Sonicle Webtop · GitHub
Thanks Giacomo,
I had a look around to Sonicle Webtop GitHub before posting and I could see anything RE Sonicle Assistant.
As Michael said maybe it is not open source… Bummer if that is the case.
I failed in my decompile and recompile effort without source…
@lucag if Sonicle Assistant is not open source and if you would like to compile a English version I have attached the Drafter.java from my failed decompile and recompile effort.
package com.tvh.sonicledrafter;
import com.auxilii.msgparser.Message;
import com.auxilii.msgparser.MsgParser;
import com.auxilii.msgparser.RecipientEntry;
import com.auxilii.msgparser.attachment.Attachment;
import com.auxilii.msgparser.attachment.FileAttachment;
import com.auxilii.msgparser.rtf.SimpleRTF2HTMLConverter;
import com.sun.mail.imap.IMAPFolder;
import com.sun.mail.imap.IMAPMessage;
import java.awt.Component;
import java.awt.Dimension;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Calendar;
import java.util.List;
import java.util.Properties;
import java.util.logging.Logger;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.activation.MimetypesFileTypeMap;
import javax.mail.Address;
import javax.mail.AuthenticationFailedException;
import javax.mail.BodyPart;
import javax.mail.FetchProfile;
import javax.mail.Flags;
import javax.mail.Folder;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.NoSuchProviderException;
import javax.mail.Session;
import javax.mail.Store;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.util.ByteArrayDataSource;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringEscapeUtils;
public class Drafter {
private static Store store;
protected static final Logger logger = Logger.getLogger(Drafter.class.getName());
private static boolean not_show_popup = false;
private static void printHelpMessage(Options options) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("Drafter", "Drafter is a tool to upload a draft to webtop and open it with the default browser.", options, "This tool is intended to support the 'Send as attachment' feature of windows applications.", true);
}
private static Options getCMDLineOptions() {
Options options = new Options();
options.addOption(new Option("h", "help", false, "Show this help message."));
OptionGroup body = new OptionGroup();
body.addOption(new Option("i", "stdin", false, "Read body text from stdin."));
OptionBuilder.withLongOpt("body");
OptionBuilder.withArgName("filename");
OptionBuilder.hasArg();
OptionBuilder.withDescription("File containing the body text");
body.addOption(OptionBuilder.create("b"));
options.addOptionGroup(body);
OptionBuilder.withLongOpt("username");
OptionBuilder.hasArg();
OptionBuilder.withArgName("email address");
OptionBuilder.withDescription("Your Sonicle Webtop Email adress.");
options.addOption(OptionBuilder.create());
OptionBuilder.withLongOpt("password");
OptionBuilder.hasArg();
OptionBuilder.withArgName("google password");
OptionBuilder.withDescription("Your Sonicle Webtop password (caution: providing this on the commandline can be a security problem).");
options.addOption(OptionBuilder.create());
OptionBuilder.withLongOpt("subject");
OptionBuilder.withArgName("text");
OptionBuilder.hasArg();
OptionBuilder.withDescription("Subject of the mail");
options.addOption(OptionBuilder.create("s"));
OptionBuilder.withLongOpt("subjectfile");
OptionBuilder.withArgName("filename");
OptionBuilder.hasArg();
OptionBuilder.withDescription("File containing the subject of the mail (UTF-8)");
options.addOption(OptionBuilder.create());
OptionBuilder.withLongOpt("attachments");
OptionBuilder.hasArgs();
OptionBuilder.withArgName("filename,filename,...");
OptionBuilder.withValueSeparator(',');
OptionBuilder.withDescription("Attachments");
options.addOption(OptionBuilder.create("a"));
OptionBuilder.withLongOpt("attachmentnames");
OptionBuilder.hasArgs();
OptionBuilder.withArgName("filename,filename,...");
OptionBuilder.withValueSeparator(',');
OptionBuilder.withDescription("Attachment names");
options.addOption(OptionBuilder.create("n"));
OptionBuilder.withLongOpt("to");
OptionBuilder.hasArgs();
OptionBuilder.withArgName("foo@bar.com,oof@rab.com,...");
OptionBuilder.withValueSeparator(',');
OptionBuilder.withDescription("destination");
options.addOption(OptionBuilder.create("t"));
options.addOption(new Option("d", "deletebody", false, "Delete bodyfile after sending."));
options.addOption(new Option(null, "deletesubjectfile", false, "Delete subjectfile after sending."));
options.addOption(new Option(null, "immediate", false, "Immediately send, don't open draft first."));
OptionBuilder.withLongOpt("cc");
OptionBuilder.hasArgs();
OptionBuilder.withArgName("foo@bar1.com,foo@rba.com");
OptionBuilder.withValueSeparator(',');
OptionBuilder.withDescription("cc");
options.addOption(OptionBuilder.create("c"));
OptionBuilder.withLongOpt("bcc");
OptionBuilder.hasArgs();
OptionBuilder.withArgName("foo@bar2.com,ofo@bar.com");
OptionBuilder.withValueSeparator(',');
OptionBuilder.withDescription("bcc");
options.addOption(OptionBuilder.create());
OptionBuilder.withLongOpt("eml");
OptionBuilder.hasArgs();
OptionBuilder.withArgName("eml path");
OptionBuilder.withDescription("eml");
options.addOption(OptionBuilder.create("e"));
OptionBuilder.withLongOpt("msg");
OptionBuilder.hasArgs();
OptionBuilder.withArgName("msg path");
OptionBuilder.withDescription("msg");
options.addOption(OptionBuilder.create("m"));
return options;
}
public static void main(String[] args) {
Options options = getCMDLineOptions();
PosixParser posixParser = new PosixParser();
try {
CommandLine cmd = posixParser.parse(options, args);
if (cmd.hasOption("help")) {
printHelpMessage(options);
System.exit(0);
}
String emailBody = " ";
String emailSubject = null;
if (cmd.hasOption("subject")) {
emailSubject = cmd.getOptionValue("subject");
} else if (cmd.hasOption("subjectfile")) {
String subjectFile = cmd.getOptionValue("subjectfile");
File subject = new File(subjectFile);
emailSubject = FileUtils.readFileToString(subject);
if (cmd.hasOption("deletesubjectfile"))
subject.delete();
}
String username = null;
if (cmd.hasOption("username"))
username = cmd.getOptionValue("username");
String password = null;
if (cmd.hasOption("password"))
password = cmd.getOptionValue("password");
String domain = null;
if (cmd.hasOption("domain"))
domain = cmd.getOptionValue("domain");
String[] bcc = cmd.getOptionValues("bcc");
String[] cc = cmd.getOptionValues("cc");
Boolean sendImmediately = Boolean.valueOf(cmd.hasOption("immediate"));
String[] attachments = cmd.getOptionValues("attachments");
String[] attachmentnames = cmd.getOptionValues("attachmentnames");
String[] destinations = cmd.getOptionValues("to");
if (attachments != null && attachmentnames != null) {
boolean s = false;
for (int i = 0; i < attachmentnames.length; i++) {
if (attachmentnames[i] != null && !attachmentnames[i].trim().equals("")) {
emailBody = emailBody + attachmentnames[i] + "\n\r";
s = true;
}
}
if (s)
emailBody = "Message ready to be sent with the following files or links attached:\n\r" + emailBody;
}
Credentials credentials = Authenticater.getValidCredentials(username, password, domain);
String nsp = PropUtils.read("not_show_popup");
if (nsp != "")
not_show_popup = Boolean.parseBoolean(nsp);
if (credentials != null) {
boolean success = false;
try {
if (cmd.hasOption("eml")) {
String pathEml = cmd.getOptionValue("eml");
composeMailFromEml(credentials, emailSubject, pathEml, attachments, attachmentnames, destinations, cc, bcc, sendImmediately);
} else if (cmd.hasOption("msg")) {
String pathEml = cmd.getOptionValue("msg");
composeMailFromMsg(credentials, pathEml, sendImmediately.booleanValue());
} else {
composeMail(credentials, emailSubject, emailBody, attachments, attachmentnames, destinations, cc, bcc, sendImmediately);
}
success = true;
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());
JOptionPane.showMessageDialog(null, "Invalid login, please try again!");
credentials = Authenticater.getValidCredentials(username, null, null);
success = false;
}
}
} catch (ParseException ex) {
JOptionPane.showMessageDialog(null, ex.getMessage());
printHelpMessage(options);
System.exit(7);
} catch (IOException ex) {
System.out.println("IO Exception " + ex.getLocalizedMessage());
printHelpMessage(options);
System.exit(2);
} catch (LoginException ex) {
System.out.println(ex.getMessage());
System.exit(3);
}
System.exit(0);
}
private static InternetAddress[] stringToInternetAddress(String[] addresses) throws AddressException {
if (addresses != null && addresses.length > 0) {
InternetAddress[] ia = new InternetAddress[addresses.length];
for (int i = 0; i < addresses.length; i++)
ia[i] = new InternetAddress(addresses[i]);
return ia;
}
return null;
}
private static void composeMailFromEml(Credentials credentials, String subjectText, String pathEml, String[] attachments, String[] attachmentnames, String[] destinations, String[] cc, String[] bcc, Boolean sendImmediately) throws IOException, AuthenticationFailedException {
if (subjectText == null)
subjectText = "";
PleaseWait please = new PleaseWait();
please.open();
try {
Properties props = null;
Session session = null;
props = System.getProperties();
props.setProperty("mail.imaps.ssl.trust", "*");
session = Session.getDefaultInstance(props, null);
store = session.getStore("imaps");
if (store.isConnected())
store.close();
String domain = credentials.getDomain();
System.out.println("domain=" + domain);
if (domain == null || domain.equals("")) {
if (credentials.getUsername() != null && !credentials.equals("")) {
int at = credentials.getUsername().indexOf("@");
if (at > 0)
domain = credentials.getUsername().substring(at + 1);
}
try {
store.connect("imap." + domain, credentials.getUsername(), credentials.getPassword());
} catch (Exception ex) {}
} else {
store.connect(domain, credentials.getUsername(), credentials.getPassword());
}
Folder fr = store.getDefaultFolder();
char separator = fr.getSeparator();
System.out.println("connessione=" + store.isConnected());
String signature = Signature.getSignature(credentials);
if (signature == null)
signature = "";
InputStream s = new FileInputStream(new File(pathEml));
MimeMessage draftMail = new MimeMessage(session, s);
subjectText = draftMail.getSubject();
draftMail.setSubject(subjectText);
String[] from = { credentials.getUsername() };
draftMail.addFrom((Address[])stringToInternetAddress(from));
draftMail.setHeader("Sonicle-from-drafter-eml", "true");
if (sendImmediately.booleanValue()) {
Transport.send((Message)draftMail);
} else {
Folder[] f = store.getDefaultFolder().list("*");
long threadId = 0L;
for (Folder fd : f) {
IMAPFolder folder = (IMAPFolder)fd;
System.out.println("Folder=" + fd.getFullName());
boolean thisIsDrafts = false;
String[] atts = folder.getAttributes();
if (fd.getFullName().equalsIgnoreCase("Drafts") || fd.getFullName().equalsIgnoreCase("Bozze"))
thisIsDrafts = true;
if (thisIsDrafts) {
System.out.println("Drafts Trovato");
folder.open(2);
Message[] messages = new Message[1];
messages[0] = (Message)draftMail;
folder.appendMessages(messages);
messages[0] = folder.getMessage(folder.getMessageCount());
FetchProfile fp = new FetchProfile();
fp.add(FetchProfile.Item.ENVELOPE);
fp.add(FetchProfile.Item.FLAGS);
fp.add(FetchProfile.Item.CONTENT_INFO);
fp.add("Message-ID");
fp.add("X-Priority");
folder.fetch(messages, fp);
IMAPMessage googleMessage = (IMAPMessage)messages[0];
threadId = 999999L;
folder.close(false);
if (thisIsDrafts)
break;
}
}
if (threadId == 0L)
System.exit(6);
store.close();
please.close();
if (!not_show_popup) {
JOptionPane op = new JOptionPane("WebTop: Please open Webtop drafts to find your drafted email with you attached file", 1);
JDialog dialog = op.createDialog("WebTop");
dialog.setAlwaysOnTop(true);
dialog.setModal(true);
dialog.setDefaultCloseOperation(2);
dialog.setVisible(true);
}
}
} catch (NoSuchProviderException e) {
e.printStackTrace();
System.exit(4);
} catch (AuthenticationFailedException e) {
throw e;
} catch (MessagingException e) {
e.printStackTrace();
System.exit(5);
} finally {
please.close();
}
}
private static void composeMail(Credentials credentials, String subjectText, String bodyText, String[] attachments, String[] attachmentnames, String[] destinations, String[] cc, String[] bcc, Boolean sendImmediately) throws IOException, AuthenticationFailedException {
if (subjectText == null)
subjectText = "";
if (bodyText == null)
bodyText = "";
PleaseWait please = new PleaseWait();
please.open();
try {
Properties props = null;
Session session = null;
props = System.getProperties();
props.setProperty("mail.imaps.ssl.trust", "*");
session = Session.getDefaultInstance(props, null);
store = session.getStore("imaps");
if (store.isConnected())
store.close();
String domain = credentials.getDomain();
System.out.println("domain=" + domain);
if (domain == null || domain.equals("")) {
if (credentials.getUsername() != null && !credentials.equals("")) {
int at = credentials.getUsername().indexOf("@");
if (at > 0)
domain = credentials.getUsername().substring(at + 1);
}
try {
store.connect("imap." + domain, credentials.getUsername(), credentials.getPassword());
} catch (Exception ex) {}
} else {
store.connect(domain, credentials.getUsername(), credentials.getPassword());
}
Folder fr = store.getDefaultFolder();
char separator = fr.getSeparator();
System.out.println("connessione=" + store.isConnected());
String signature = Signature.getSignature(credentials);
if (signature == null)
signature = "";
MimeMessage mimeMessage = new MimeMessage(session);
mimeMessage.setSubject(subjectText);
MimeMultipart mimeMultipart = new MimeMultipart();
MimeBodyPart mimeBodyPart = new MimeBodyPart();
String[] from = { credentials.getUsername() };
mimeMessage.addFrom((Address[])stringToInternetAddress(from));
if (bodyText.toLowerCase().indexOf("<body") < 0)
bodyText = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></head><body>" + StringEscapeUtils.escapeHtml3(bodyText).replace("\n", "<br />\n") + "<br>" + "</body></html>";
if (signature != null && signature != "") {
StringBuilder b = new StringBuilder(bodyText);
if (signature.indexOf("</") < 0)
signature = StringEscapeUtils.escapeHtml3(signature);
b.replace(bodyText.lastIndexOf("</body>"), bodyText.lastIndexOf("</body>") + 7, "<br>" + signature + "</body>");
bodyText = b.toString();
}
mimeBodyPart.setContent(bodyText, "text/html; charset=utf-8");
mimeMessage.setHeader("Sonicle-from-drafter", "true");
mimeBodyPart.setDisposition("inline");
mimeMultipart.addBodyPart((BodyPart)mimeBodyPart);
if (attachments != null)
for (int i = 0; i < attachments.length; i++) {
MimeBodyPart mimeBodyPart1 = new MimeBodyPart();
DataSource source = new FileDataSource(attachments[i]);
mimeBodyPart1.setDataHandler(new DataHandler(source));
if (attachmentnames != null && attachmentnames.length > i) {
String filename = attachmentnames[i];
int l = filename.lastIndexOf("/");
int ls = filename.lastIndexOf("\\");
if (l > 0) {
filename = filename.substring(l + 1);
} else if (ls > 0) {
filename = filename.substring(ls + 1);
}
mimeBodyPart1.setFileName(filename);
} else {
String filename = attachments[i];
int l = filename.lastIndexOf("/");
int ls = filename.lastIndexOf("\\");
if (l > 0) {
filename = filename.substring(l + 1);
} else if (ls > 0) {
filename = filename.substring(ls + 1);
}
mimeBodyPart1.setFileName(filename);
}
mimeMultipart.addBodyPart((BodyPart)mimeBodyPart1);
}
mimeMessage.setContent((Multipart)mimeMultipart);
if (destinations != null && destinations.length > 0)
mimeMessage.setRecipients(Message.RecipientType.TO, (Address[])stringToInternetAddress(destinations));
if (cc != null && cc.length > 0)
mimeMessage.setRecipients(Message.RecipientType.CC, (Address[])stringToInternetAddress(cc));
if (bcc != null && bcc.length > 0)
mimeMessage.setRecipients(Message.RecipientType.BCC, (Address[])stringToInternetAddress(bcc));
mimeMessage.setFlag(Flags.Flag.SEEN, true);
if (sendImmediately.booleanValue()) {
Transport.send((Message)mimeMessage);
} else {
Folder[] f = store.getDefaultFolder().list("*");
long threadId = 0L;
for (Folder fd : f) {
IMAPFolder folder = (IMAPFolder)fd;
System.out.println("Folder=" + fd.getFullName());
boolean thisIsDrafts = false;
String[] atts = folder.getAttributes();
if (fd.getFullName().equalsIgnoreCase("Drafts") || fd.getFullName().equalsIgnoreCase("Bozze"))
thisIsDrafts = true;
if (thisIsDrafts) {
System.out.println("Drafts Trovato");
folder.open(2);
Message[] messages = new Message[1];
messages[0] = (Message)mimeMessage;
folder.appendMessages(messages);
messages[0] = folder.getMessage(folder.getMessageCount());
FetchProfile fp = new FetchProfile();
fp.add(FetchProfile.Item.ENVELOPE);
fp.add(FetchProfile.Item.FLAGS);
fp.add(FetchProfile.Item.CONTENT_INFO);
fp.add("Message-ID");
fp.add("X-Priority");
folder.fetch(messages, fp);
IMAPMessage googleMessage = (IMAPMessage)messages[0];
threadId = 999999L;
folder.close(false);
if (thisIsDrafts)
break;
}
}
if (threadId == 0L)
System.exit(6);
store.close();
please.close();
if (!not_show_popup) {
JOptionPane op = new JOptionPane("WebTop: Please open Webtop drafts to find your drafted email with you attached file", 1);
JDialog dialog = op.createDialog("WebTop");
dialog.setAlwaysOnTop(true);
dialog.setModal(true);
dialog.setDefaultCloseOperation(2);
dialog.setVisible(true);
}
}
} catch (NoSuchProviderException e) {
e.printStackTrace();
System.exit(4);
} catch (AuthenticationFailedException e) {
throw e;
} catch (MessagingException e) {
e.printStackTrace();
System.exit(5);
} finally {
please.close();
}
}
static class PleaseWait {
private JDialog dialog = new JDialog();
PleaseWait() {
JLabel label = new JLabel("Please wait");
this.dialog.setLocationRelativeTo((Component)null);
this.dialog.setTitle("Attendere");
this.dialog.add(label);
this.dialog.setPreferredSize(new Dimension(250, 100));
this.dialog.setAlwaysOnTop(true);
this.dialog.pack();
}
public void open() {
this.dialog.setVisible(true);
}
public void close() {
this.dialog.setVisible(false);
this.dialog.dispose();
}
}
public static void composeMailFromMsg(Credentials credentials, String pathMsg, boolean sendImmediately) throws AuthenticationFailedException {
MimeMessage mail = null;
PleaseWait please = new PleaseWait();
please.open();
try {
Properties props = null;
Session session = null;
props = System.getProperties();
props.setProperty("mail.imaps.ssl.trust", "*");
session = Session.getDefaultInstance(props, null);
store = session.getStore("imaps");
if (store.isConnected())
store.close();
String domain = credentials.getDomain();
System.out.println("domain=" + domain);
if (domain == null || domain.equals("")) {
if (credentials.getUsername() != null && !credentials.equals("")) {
int at = credentials.getUsername().indexOf("@");
if (at > 0)
domain = credentials.getUsername().substring(at + 1);
}
try {
store.connect("imap." + domain, credentials.getUsername(), credentials.getPassword());
} catch (Exception ex) {}
} else {
store.connect(domain, credentials.getUsername(), credentials.getPassword());
}
Folder fr = store.getDefaultFolder();
char separator = fr.getSeparator();
System.out.println("connessione=" + store.isConnected());
String signature = Signature.getSignature(credentials);
if (signature == null)
signature = "";
mail = new MimeMessage(session);
MsgParser msgp = new MsgParser();
Message msg = msgp.parseMsg(pathMsg);
Calendar receivedDate = Calendar.getInstance();
Calendar sentDate = Calendar.getInstance();
if (msg.getDate() != null)
receivedDate.setTime(msg.getDate());
if (msg.getCreationDate() != null)
sentDate.setTime(msg.getCreationDate());
MimeBodyPart htmlPart = new MimeBodyPart();
MimeMultipart mimeMultipart = new MimeMultipart();
if (msg.getBodyRTF() != null) {
SimpleRTF2HTMLConverter converter = new SimpleRTF2HTMLConverter();
htmlPart.setContent(converter.rtf2html(msg.getBodyRTF()), "text/html");
mimeMultipart.addBodyPart((BodyPart)htmlPart);
} else if (msg.getBodyHTML() != null) {
htmlPart.setContent(msg.getBodyHTML(), "text/html");
mimeMultipart.addBodyPart((BodyPart)htmlPart);
} else if (msg.getBodyText() != null) {
htmlPart.setContent(msg.getBodyText(), "text/plain");
mimeMultipart.addBodyPart((BodyPart)htmlPart);
} else {
mail.setContent(null, "application/octet-stream");
}
mail.setSubject((msg.getSubject() == null || msg.getSubject().isEmpty()) ? "" : msg.getSubject());
mail.setFrom((Address)new InternetAddress(msg.getFromEmail(), msg.getFromName()));
List<RecipientEntry> list_cc = msg.getCcRecipients();
if (list_cc.size() > 0) {
InternetAddress[] arrayOfInternetAddress = new InternetAddress[list_cc.size()];
int i = 0;
for (RecipientEntry e : list_cc) {
arrayOfInternetAddress[i] = new InternetAddress(e.getToEmail(), e.getToName());
i++;
}
mail.setRecipients(Message.RecipientType.CC, (Address[])arrayOfInternetAddress);
}
List<RecipientEntry> list_bcc = msg.getBccRecipients();
if (list_bcc.size() > 0) {
InternetAddress[] arrayOfInternetAddress = new InternetAddress[list_bcc.size()];
int i = 0;
for (RecipientEntry e : list_bcc) {
arrayOfInternetAddress[i] = new InternetAddress(e.getToEmail(), e.getToName());
i++;
}
mail.setRecipients(Message.RecipientType.BCC, (Address[])arrayOfInternetAddress);
}
mail.setSentDate(sentDate.getTime());
String subjectText = mail.getSubject();
mail.setSubject(subjectText);
List<Attachment> list_attachments = msg.getAttachments();
if (list_attachments.size() > 0)
for (Attachment a : list_attachments) {
FileAttachment fa = (FileAttachment)a;
MimeBodyPart mimeBodyPart = new MimeBodyPart();
String mime = (new MimetypesFileTypeMap()).getContentType(fa.getFilename());
ByteArrayDataSource b = new ByteArrayDataSource(fa.getData(), mime);
mimeBodyPart.setDataHandler(new DataHandler((DataSource)b));
mimeBodyPart.setFileName(fa.getLongFilename());
mimeMultipart.addBodyPart((BodyPart)mimeBodyPart);
}
mail.setContent((Multipart)mimeMultipart);
mail.setHeader("Sonicle-from-drafter-eml", "true");
if (sendImmediately) {
Transport.send((Message)mail);
} else {
Folder[] f = store.getDefaultFolder().list("*");
long threadId = 0L;
for (Folder fd : f) {
IMAPFolder folder = (IMAPFolder)fd;
System.out.println("Folder=" + fd.getFullName());
boolean thisIsDrafts = false;
String[] atts = folder.getAttributes();
if (fd.getFullName().equalsIgnoreCase("Drafts") || fd.getFullName().equalsIgnoreCase("Bozze"))
thisIsDrafts = true;
if (thisIsDrafts) {
System.out.println("Drafts Trovato");
folder.open(2);
Message[] messages = new Message[1];
messages[0] = (Message)mail;
folder.appendMessages(messages);
messages[0] = folder.getMessage(folder.getMessageCount());
FetchProfile fp = new FetchProfile();
fp.add(FetchProfile.Item.ENVELOPE);
fp.add(FetchProfile.Item.FLAGS);
fp.add(FetchProfile.Item.CONTENT_INFO);
fp.add("Message-ID");
fp.add("X-Priority");
folder.fetch(messages, fp);
IMAPMessage googleMessage = (IMAPMessage)messages[0];
threadId = 999999L;
folder.close(false);
if (thisIsDrafts)
break;
}
}
if (threadId == 0L)
System.exit(6);
store.close();
please.close();
if (!not_show_popup) {
JOptionPane op = new JOptionPane("WebTop: Please open Webtop drafts to find your drafted email with you attached file", 1);
JDialog dialog = op.createDialog("WebTop");
dialog.setAlwaysOnTop(true);
dialog.setModal(true);
dialog.setDefaultCloseOperation(2);
dialog.setVisible(true);
}
}
} catch (NoSuchProviderException e) {
JOptionPane.showMessageDialog(null, e.getMessage());
e.printStackTrace();
System.exit(4);
} catch (AuthenticationFailedException e) {
JOptionPane.showMessageDialog(null, e.getMessage());
throw e;
} catch (MessagingException e) {
JOptionPane.showMessageDialog(null, e.getMessage());
e.printStackTrace();
System.exit(5);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());
e.printStackTrace();
} finally {
please.close();
}
}
}
/* Location: C:\Users\Mark\eclipse-workspace\Drafter project\orginal\sonicle-webtop-drafter.jar!\com\tvh\sonicledrafter\Drafter.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
Hello, this software is very old and is no more maintained.
I don’t think there was any multi language support in that code, but I’m not sure.
I don’t even know if I will find the updated source code in our repositories, as it was abandoned.
If anyone is interested in maintaining that old source code, I can see if I can find it and give it to you.
Thanks Mark,
I asked Gabriele to answer your request … he is certainly more informed than me
I think Sonicle Assistant is a needed app which makes Webtop a Software email client replacement, I think it is worth saving.
RE: I don’t think there was any multi language support in that code, but I’m not sure.
Not from what I saw with what I decoded. Language is all hard coded.
RE: I don’t even know if I will find the updated source code in our repositories, as it was abandoned.
It would be great if you could have a look.
RE: If anyone is interested in maintaining that old source code, I can see if I can find it and give it to you.
Being a System Admin it is a bit left field of what normally do, I am better code hacker than coder. But if none steps forward maybe I could do with a little guidance from the community…
Thanks for you reply Garbriele
Hi Gabriele, by any change did you have any luck finding the source code?