Solved

How to send in Java Applet like from Netscape

Posted on 1997-11-03
8
183 Views
Last Modified: 2012-06-21
Hi,

We use a gateway product to send faxes from Email clients.

It works fine with Netscape Communicator.

When we want to send a fax to number 0123456789, we put the following address:

0123456789 <faxmaker@test.fr>

How can we do the same with an applet client ?

Thank you in advance

Renaud
0
Comment
Question by:hilleret
8 Comments
 
LVL 4

Expert Comment

by:rembo
Comment Utility

I would imagine that you are doing this using a CGI
script and a POST from an HTML form.

So, you can do the following from a Java applet:

showDocument("http://" + getCodeBase.getHost() + "/cgi-bin/cginame?number="+phonetext.getText()+"&"host="+hosttext.getText());

This will call the cgi script cginame (replace name with
your CGI script) with the text out of two text fields
phonetext and hosttext which should contain the phone
numbers entered by the user.

That should do it.  Hope that helps,

-Tony


0
 
LVL 2

Author Comment

by:hilleret
Comment Utility
Sorry, but we do not send messages with a CGI.

We use a product call IntranetFax from GFIFax that transforms Emails to faxes.

Renaud
0
 
LVL 5

Expert Comment

by:fontaine
Comment Utility
To do what you need, you have to set up a mail server on the same machine as the Web server that will deliver the applet (this is due to applet security restrictions) and write a Java applet that acts as a mail client. The user will enter the data into the applet, that will send a mail to the mailbox your tool uses. It will then turn the mail to a fax, as usual. If your tool acts in fact as a mail server dedicated to sending faxes, you don't need to install a new mail server but simply to install your tool on the same machine as the Web server. Hereafter an example of Java applet that acts as a mail client (with source code):

http://www.chez.com/vasile/mail25/VasSendMail.html

It should be quite straigthforward to customize that code to your needs. You should also find a library to send mails from an applet at the www.gamelan.com site.

Bertrand

0
 
LVL 5

Expert Comment

by:fontaine
Comment Utility
To complete my answer: at the www.gamelan.com site, type the keywords "mail" and "smtp" into the search engine query, you will have plenty of resources.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 2

Author Comment

by:hilleret
Comment Utility
Peut-etre pourrions-nous parler français ???

Ma question porte uniquement sur la maniere de spécifier l'adresse Email précédée du numero de fax dans un applet Java !

Merci

A+

Renaud

0
 
LVL 5

Expert Comment

by:fontaine
Comment Utility
Renaud, je ne comprends plus ta question. L'applet que je te propose permettent l'envoi de mails comme si tu te trouvais en face de ton client mail, il n'y a aucune difference.Ton probleme est-il un probleme d'interface utilisateur, ou as-tu deja ecrit un applet sans pouvoir le faire fonctionner, ou????
0
 
LVL 6

Expert Comment

by:jpk041897
Comment Utility
If IntranetFax supports OLE automation, there is another way you could solve your problem.
0
 
LVL 1

Accepted Solution

by:
toml032697 earned 200 total points
Comment Utility
I don't know if this is usefull for you, as people has proposed where you can find information about SMTP, etc. But I extracted a some code from my e-mail applet which communicates with a SMTP server. This code will throw a security exception in Netscape if it is connected to another server than which it came from. If it is signed and UniversalConnect is enabled then you can connect to a third part otherwise not.

public void send() {
  try {
    // Open connection to SMTP server
    socket=new Socket(mailServer,port);

    in=new DataInputStream(socket.getInputStream());
    out=new PrintStream(socket.getOutputStream());

    // Send message
    sendline("HELO "+socket.getInetAddress().getHostName());
    sendline("MAIL FROM: "+userEmail);
    sendline("RCPT TO: 0123456789 <faxmaker@test.fr>");
    sendline("DATA");

    out.print("Subject: "+subject+"\n");
    StringTokenizer st=new StringTokenizer(message,"\n");
    while(st.hasMoreTokens()) {
      String s=st.nextToken();
      if(s.startsWith("."))
        out.print(".");
        out.print(s+"\n");
      }
      out.print("\r\n");
      sendline(".");

      // Close connection
      socket.close();
    } catch(Exception e) {
      System.out.println(e);
  }
}

void sendline(String data) throws IOException {
  out.println(data);
  out.flush();
  String s=in.readLine();
  System.out.println(s);  // Only for debuging
}

    -Tom
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now