public void actionPerformed (ActionEvent e)	
		 {
		 		String hostServer, fromEmail, fromTo, contentSubject, contentMsg;
				
      	if (e.getSource()== btnSend)
			{
             hostServer=txtHost.getText();
				 fromEmail=txtFrom.getText();
				 fromTo=txtTo.getText();
				 contentSubject=txtSub.getText();
				 contentMsg=msgArea.getText();
				 
   			   // Establish a TCP connection with the mail server.
  				    Socket soc = new Socket("" + hostServer, 25);
 	
   			   // Create a BufferedReader to read a line at a time.
  				    InputStream is = soc.getInputStream();
  				    InputStreamReader isr = new InputStreamReader(is);
  				    BufferedReader br = new BufferedReader(isr);
 
  			      // Read greeting from the server.
    				  String response = br.readLine();
  					  System.out.println(response);
  		
		if (!response.startsWith("220")) 
		{
         throw new Exception("220 reply not received from server.");
      }
 
     			 // Get a reference to the socket's output stream.
    				  OutputStream os = soc.getOutputStream();
 
    			  // Send HELO command and get server response.
    			     String command = "HELO Ng\r\n";
    			     System.out.print(command);
     				  os.write(command.getBytes("US-ASCII"));
                 response = br.readLine();
                 System.out.println(response);
      if (!response.startsWith("250")) 
		{
         throw new Exception("250 reply not received from server.");
      }
 
    			  // Send MAIL FROM command.
   				  String from = "\r\n"+ email.getFromEmail();
    				  System.out.print(from);
    				  os.write(from.getBytes("US-ASCII"));
  					  response = br.readLine();
    				  System.out.println(response);
      if (!response.startsWith("250")) 
		{
         throw new Exception("250 reply not received from server.");
      }
       
     			 // Send RCPT TO command.
     				 String rcpt = "\r\n"+ email.getFromTo();
    				 System.out.print(rcpt);
                os.write(rcpt.getBytes("US-ASCII"));
                response = br.readLine();
                System.out.println(response);
      
		if (!response.startsWith("250"))
		{
         throw new Exception("250 reply not received from server.");
      }
       
     			 // Send DATA command.
     				 String data = "\r\n"+ email.getContentSubject();
    				 System.out.print(data);
    				 os.write(data.getBytes("US-ASCII"));
      			 response = br.readLine();
                System.out.println(response);
      
		if (!response.startsWith("354")) 
		{
         throw new Exception("354 reply not received from server.");
      }
      
     			 // Send message data.
      			 String subject = "\r\n\r\n"+ email.getContentMsg();
      			 System.out.print(subject);
                os.write(subject.getBytes("US-ASCII"));
      
     			 // End with line with a single period.
                String end = ".\r\n";
                System.out.print(end);
                os.write(end.getBytes("US-ASCII"));
                response = br.readLine();
                System.out.println(response);
     
	   if (!response.startsWith("250")) 
		{
         throw new Exception("250 reply not received from server.");
      }
      
     			 // Send QUIT command.
      			 String quit = "QUIT\r\n";
      			 System.out.print(quit);
                os.write(quit.getBytes("US-ASCII"));
      			 response = br.readLine();
				    System.out.println(response);
					 
      if (!response.startsWith("221")) 
		{
         throw new Exception("221 reply not received from server.");
      }
		

   }

This is Java code not Javascript code; the languages are entirely different.

The thread has been moved to the Java forum.

On another note, you're more likely to get help with the problem if you explain the problem briefly -- rather than just posting a block of code and expecting others to actually find the problem aswel.

You're more likely to get help with the problem if you explain the problem briefly -- rather than just posting a block of code and expecting others to actually find the problem aswel.

Not only "more likely", but more like "required". I for one, and most others here, will not even bother to glance at the code without much more, and detailed information.

What compiler messages are you getting?
What runtime error are you getting?
What output do you get that you did not expect (and what did you expect)?
What output did you not get that you expected?
etc.

Not only "more likely", but more like "required". I for one, and most others here, will not even bother to glance at the code without much more, and detailed information.

What compiler messages are you getting?
What runtime error are you getting?
What output do you get that you did not expect (and what did you expect)?
What output did you not get that you expected?
etc.

----jGRASP exec: javac -g C:\Users\Denniskhor\Desktop\EmailSenderSys.java

EmailSenderSys.java:127: cannot find symbol
symbol : class Socket
location: class EmailSenderSys
Socket soc = new Socket("" + hostServer, 25);
^
EmailSenderSys.java:127: cannot find symbol
symbol : class Socket
location: class EmailSenderSys
Socket soc = new Socket("" + hostServer, 25);
^
EmailSenderSys.java:130: cannot find symbol
symbol : class InputStream
location: class EmailSenderSys
InputStream is = soc.getInputStream();
^
EmailSenderSys.java:131: cannot find symbol
symbol : class InputStreamReader
location: class EmailSenderSys
InputStreamReader isr = new InputStreamReader(is);
^
EmailSenderSys.java:131: cannot find symbol
symbol : class InputStreamReader
location: class EmailSenderSys
InputStreamReader isr = new InputStreamReader(is);
^
EmailSenderSys.java:132: cannot find symbol
symbol : class BufferedReader
location: class EmailSenderSys
BufferedReader br = new BufferedReader(isr);
^
EmailSenderSys.java:132: cannot find symbol
symbol : class BufferedReader
location: class EmailSenderSys
BufferedReader br = new BufferedReader(isr);
^
EmailSenderSys.java:143: cannot find symbol
symbol : class OutputStream
location: class EmailSenderSys
OutputStream os = soc.getOutputStream();
^
EmailSenderSys.java:151: cannot find symbol
symbol : variable email
location: class EmailSenderSys
email = new EmailSender(hostServer, fromEmail, fromTo, contentSubject, contentMsg);
^
EmailSenderSys.java:159: cannot find symbol
symbol : variable email
location: class EmailSenderSys
String from = "\r\n"+ email.getFromEmail();
^
EmailSenderSys.java:161: cannot find symbol
symbol : variable os
location: class EmailSenderSys
os.write(from.getBytes("US-ASCII"));
^
EmailSenderSys.java:164: cannot find symbol
symbol : variable email
location: class EmailSenderSys
email = new EmailSender(hostServer, fromEmail, fromTo, contentSubject, contentMsg);
^
EmailSenderSys.java:172: cannot find symbol
symbol : variable email
location: class EmailSenderSys
String rcpt = "\r\n"+ email.getFromTo();
^
EmailSenderSys.java:174: cannot find symbol
symbol : variable os
location: class EmailSenderSys
os.write(rcpt.getBytes("US-ASCII"));
^
EmailSenderSys.java:177: cannot find symbol
symbol : variable email
location: class EmailSenderSys
email = new EmailSender(hostServer, fromEmail, fromTo, contentSubject, contentMsg);
^
EmailSenderSys.java:185: cannot find symbol
symbol : variable email
location: class EmailSenderSys
String data = "\r\n"+ email.getContentSubject();
^
EmailSenderSys.java:187: cannot find symbol
symbol : variable os
location: class EmailSenderSys
os.write(data.getBytes("US-ASCII"));
^
EmailSenderSys.java:190: cannot find symbol
symbol : variable email
location: class EmailSenderSys
email = new EmailSender(hostServer, fromEmail, fromTo, contentSubject, contentMsg);
^
EmailSenderSys.java:198: cannot find symbol
symbol : variable email
location: class EmailSenderSys
String subject = "\r\n\r\n"+ email.getContentMsg();
^
EmailSenderSys.java:200: cannot find symbol
symbol : variable os
location: class EmailSenderSys
os.write(subject.getBytes("US-ASCII"));
^
EmailSenderSys.java:205: cannot find symbol
symbol : variable os
location: class EmailSenderSys
os.write(end.getBytes("US-ASCII"));
^
EmailSenderSys.java:208: cannot find symbol
symbol : variable email
location: class EmailSenderSys
email = new EmailSender(hostServer, fromEmail, fromTo, contentSubject, contentMsg);
^
EmailSenderSys.java:218: cannot find symbol
symbol : variable os
location: class EmailSenderSys
os.write(quit.getBytes("US-ASCII"));
^
EmailSenderSys.java:221: cannot find symbol
symbol : variable email
location: class EmailSenderSys
email = new EmailSender(hostServer, fromEmail, fromTo, contentSubject, contentMsg);
^
24 errors

Fix your imports. You seem to be attempting to use a lot of classes without ever having imported them.

Are you importing any of the packages that these things are?

Fix your imports. You seem to be attempting to use a lot of classes without ever having imported them.

wat is import?? how?? i jz beginner in java...

wat is import?? how?? i jz beginner in java...

Then obviously you didn't copy all of the appropriate code from wherever you copied this routine. You need to specify "import <package>.<class>;" for each of those classes that you are using.

Honestly, if you don't know what an import is then you have no hope of just jumping in to modify all of that code. You need to start with some basics first. See the "Starting Java" Read Me post at the top of the forum.

import java.util.*;         // Utilities
import java.awt.*;
import java.awt.event.*;    // ActionListener
import javax.swing.*;       //GUI
import javax.swing.border.TitledBorder;


public class EmailSenderSys extends JFrame implements ActionListener
{
private JLabel host,name,from,to,subject,msg;
private JButton btnSend,btnReset,btnExit;
private JTextField txtHost,txtFrom,txtTo,txtSub;
private JPanel mail;
private JTextArea msgArea;
private String mailFrom,rcptTo,Subject;


EmailSenderSys()    // Constructor
{
super ("Email Sender");


CreateInterface();


setSize (700,520);
setVisible(true);
}   // Constructor


public void CreateInterface()
{
Container pane = getContentPane();
pane.setLayout(null);


// Create JLabel
name = new JLabel ("Email Sender");
name.setBounds(265, 10, 600, 25);
name.setFont(new Font("Georgia", Font.BOLD,25));
name.setForeground(Color.blue);
pane.add(name);


// Create Email Sender Panel
mail = new JPanel();
mail.setBounds(10,50,670,142);
mail.setBorder(new TitledBorder("Email"));
mail.setLayout(null);
pane.add(mail);


host = new JLabel ("Local Mail Server :");
host.setBounds(20, 4, 180, 60);
mail.add(host);


txtHost = new JTextField();
txtHost.setBounds(140, 20, 520, 25);
mail.add(txtHost);


from = new JLabel ("From :");
from.setBounds(20, 32, 180, 60);
mail.add(from);


txtFrom = new JTextField();
txtFrom.setBounds(140, 48, 520, 25);
mail.add(txtFrom);


to = new JLabel ("To :");
to.setBounds(20,60, 180, 60);
mail.add(to);


txtTo = new JTextField();
txtTo.setBounds(140,76, 520, 25);
mail.add(txtTo);


subject = new JLabel ("Subject :");
subject.setBounds(20, 86, 180, 60);
mail.add(subject);


txtSub = new JTextField();
txtSub.setBounds(140,104, 520, 25);
mail.add(txtSub);


// Create Message Area
msgArea = new JTextArea();
msgArea.setBounds(10, 170, 670, 250);
msgArea.setBorder(new TitledBorder("Message"));
JScrollPane sP = new JScrollPane(msgArea);
pane.add(sP);
pane.add(msgArea);


//Create Send Button
btnSend = new JButton("Send");
btnSend.setBounds(185,425,100,28);
pane.add(btnSend);
btnSend.addActionListener(this);


//Create Reset Button
btnReset = new JButton("Reset");
btnReset.setBounds(305,425,100,28);
pane.add(btnReset);
btnReset.addActionListener(this);


//Create Exit Button
btnExit = new JButton("Exit");
btnExit.setBounds(425,425,100,28);
pane.add(btnExit);
btnExit.addActionListener(this);


}



public static void main(String []agrs)
{
EmailSenderSys bs = new EmailSenderSys();
bs.setDefaultCloseOperation(EXIT_ON_CLOSE);


}// main class



public void actionPerformed (ActionEvent e)
{
String hostServer, fromEmail, fromTo, contentSubject, contentMsg;


if (e.getSource()== btnSend)
{
hostServer=txtHost.getText();
fromEmail=txtFrom.getText();
fromTo=txtTo.getText();
contentSubject=txtSub.getText();
contentMsg=msgArea.getText();


// Establish a TCP connection with the mail server.
Socket soc = new Socket("" + hostServer, 25);


// Create a BufferedReader to read a line at a time.
InputStream is = soc.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);


// Read greeting from the server.
String response = br.readLine();
System.out.println(response);


if (!response.startsWith("220"))
{
throw new Exception("220 reply not received from server.");


// Get a reference to the socket's output stream.
OutputStream os = soc.getOutputStream();


// Send HELO command and get server response.
String command = "HELO Ng\r\n";
System.out.print(command);
os.write(command.getBytes("US-ASCII"));
response = br.readLine();
System.out.println(response);
email = new EmailSender(hostServer, fromEmail, fromTo, contentSubject,  contentMsg);
}


if (!response.startsWith("250"))
{
throw new Exception("250 reply not received from server.");


// Send MAIL FROM command.
String from = "\r\n"+ email.getFromEmail();
System.out.print(from);
os.write(from.getBytes("US-ASCII"));
response = br.readLine();
System.out.println(response);
email = new EmailSender(hostServer, fromEmail, fromTo, contentSubject,  contentMsg);
}


if (!response.startsWith("250"))
{
throw new Exception("250 reply not received from server.");


// Send RCPT TO command.
String rcpt = "\r\n"+ email.getFromTo();
System.out.print(rcpt);
os.write(rcpt.getBytes("US-ASCII"));
response = br.readLine();
System.out.println(response);
email = new EmailSender(hostServer, fromEmail, fromTo, contentSubject,  contentMsg);
}


if (!response.startsWith("250"))
{
throw new Exception("250 reply not received from server.");


// Send DATA command.
String data = "\r\n"+ email.getContentSubject();
System.out.print(data);
os.write(data.getBytes("US-ASCII"));
response = br.readLine();
System.out.println(response);
email = new EmailSender(hostServer, fromEmail, fromTo, contentSubject,  contentMsg);
}


if (!response.startsWith("354"))
{
throw new Exception("354 reply not received from server.");


// Send message data.
String subject = "\r\n\r\n"+ email.getContentMsg();
System.out.print(subject);
os.write(subject.getBytes("US-ASCII"));


// End with line with a single period.
String end = ".\r\n";
System.out.print(end);
os.write(end.getBytes("US-ASCII"));
response = br.readLine();
System.out.println(response);
email = new EmailSender(hostServer, fromEmail, fromTo, contentSubject,  contentMsg);
}


if (!response.startsWith("250"))
{
throw new Exception("250 reply not received from server.");


// Send QUIT command.
String quit = "QUIT\r\n";
System.out.print(quit);
os.write(quit.getBytes("US-ASCII"));
response = br.readLine();
System.out.println(response);
email = new EmailSender(hostServer, fromEmail, fromTo, contentSubject,  contentMsg);
}


if (!response.startsWith("221"))
{
throw new Exception("221 reply not received from server.");
}



}



if(e.getSource()==btnReset)
{
txtHost.setText("");
txtFrom.setText("");
txtTo.setText("");
txtSub.setText("");
msgArea.setText("");
}


if(e.getSource()==btnExit)
{
System.exit(0);
}


}


} //EmailSenderSys Class

Ok, so now what problems are you having? Reposting your code with no question is not getting anywhere. No one is going to start fixing things in it for you.

If you noticed, that piece of code still doesn't import anything from java.io ;-)

Actually, no I didn't notice - I saw a wall of code with no question and didn't bother beyond that point :P

Ok, so now what problems are you having? Reposting your code with no question is not getting anywhere. No one is going to start fixing things in it for you.

i reposted full system code, i facing problem in button send there..

What problem? You need to clearly state the problem and what you do not understand.

You also need to place [code] [/code] tags around that wall of text if you expect anyone to try to actually read it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.