Solved

How to send in Java Applet like from Netscape

Posted on 1997-11-03
8
191 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
ID: 1229903

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
ID: 1229904
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
ID: 1229905
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 5

Expert Comment

by:fontaine
ID: 1229906
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
 
LVL 2

Author Comment

by:hilleret
ID: 1229907
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
ID: 1229908
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
ID: 1229909
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
ID: 1229910
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
session migration servlets 2 42
jdbc error in jsp application 20 63
ejb message driven bean mdb creation steps 2 19
Notify sent to other threads in Java 9 33
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

840 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