A List of SMTP, POP3 and IMAP Servers(Mail Server)


The following list of SMTP (Simple Mail Transfer Protocol), POP (Post Office Protocol) and IMAP ( Internet Message Access Protocol) server should help you if you don't know what mail server you should use for your mail account.

Default Ports:

    SMTP AUTH: Port 25 or 587 (some ISPs are blocking port 25)
    SMTP StartTLS Port 587
    SMTP SSL Port 465
    POP Port 110
    POP SSL Port 995
    IMAP Port 143
    IMAP SSL Port 993
    IMAP StartTLS Port 143

SMTP Server (Outgoing Messages) POP3 Server (Incoming Messages) IMAP Server (Incoming Messages)

Googlemail/Gmail SMTP POP3 Server/ IMAP Server
smtp.gmail.com
SSL Port 465
StartTLS Port 587
pop.gmail.com
SSL Port 995
Please make sure, that POP3 access is enabled in the account settings.
Login to your account and enable POP3.
imap.gmail.com
SSL Port 993
Please make sure, that IMAP access is enabled in the account settings.
Login to your account and enable IMAP.

Outlook.com SMTP POP3 Server
smtp.live.com
StartTLS Port 587
pop3.live.com
SSL Port 995
N/A
N/A

Yahoo Mail SMTP POP3 Server/ IMAP Server
smtp.mail.yahoo.com
SSL Port 465
pop.mail.yahoo.com
SSL Port 995
imap.mail.yahoo.com
SSL Port 993
Yahoo news server - news.yahoo.com

Yahoo Mail Plus SMTP POP3 Server / IMAP Server
plus.smtp.mail.yahoo.com
SSL Port 465
plus.pop.mail.yahoo.com
SSL Port 995
plus.imap.mail.yahoo.com
SSL Port 993

Hotmail SMTP / POP3 Server
smtp.live.com
StartTLS Port 587
pop3.live.com
SSL Port 995
N/A
N/A

AT&T SMTP POP3 Server / IMAP Server
smtp.att.yahoo.com
SSL Port 465
pop.att.yahoo.com
SSL Port 995
imap.att.yahoo.com
SSL Port 993

MSN SMTP POP3 Server / IMAP Server
smtp.email.msn.com
SSL Port: N/A
pop3.email.msn.com
SSL Port 110
N/A
N/A

AOL SMTP POP3 Server / IMAP Server
smtp.aol.com
Port: 587
N/A
N/A
imap.aol.com
143

Netscape SMTP POP3 Server / IMAP Server
smtp.isp.netscape.com
Port: N/A
pop3.isp.netscape.com
N/A
N/A
N/A
Netscape news server - news.netscape.com

Rediff SMTP POP3 Server / IMAP Server
smtp.rediffmailpro.com
Port: N/A
pop.rediffmailpro.com
N/A
N/A
N/A
Rediff news server - news.rediff.com

Note :- This list is without any warranties

3 comments :

Upload File using Servlet


To send an email using your a Servlet is simple enough but to start with you should have commons-fileupload.x.x.jar and commons-io-x.x.jar library files in your class path directory.

You Can download this files from You can download it from
commons-fileupload.x.x.jar ==>http://commons.apache.org/fileupload/
commons-io-x.x.jar ==> http://commons.apache.org/io/.

Upload.html

<html><head>
<title>File Uploading Form</title>
</head><body>
<h3>File Upload:</h3>
Select a file to upload: <br />
<form action="Upload" method="post" enctype="multipart/form-data">
<input type="file" name="file" size="50" /><br />
<input type="submit" value="Upload File" />
</form>
</body></html>

web.xml

Add following lines in web.xml. This would take care of accepting uploaded file and to store it in directory c:\uploaded\.

<context-param>
    <description>Location to store uploaded file</description>
    <param-name>file-upload</param-name>
    <param-value>c:\uploaded\</param-value>
</context-param>

Upload.Java

// Import required java libraries
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.io.output.*;

public class Upload extends HttpServlet {
  
   private boolean isMultipart;
   private String filePath;
   private int maxFileSize = 50 * 1024;
   private int maxMemSize = 4 * 1024;
   private File file ;

   public void init( ){
      // Get the file location where it would be stored.
      filePath =
             getServletContext().getInitParameter("file-upload");
   }
   public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException {
  // Check that we have a file upload request
  isMultipart = ServletFileUpload.isMultipartContent(request);
  response.setContentType("text/html");
  java.io.PrintWriter out = response.getWriter( );
  if( !isMultipart ){
     out.println("<html><head>");
     out.println("<title>Servlet upload</title>"); 
     out.println("</head><body>");
     out.println("<p>No file uploaded</p>");
     out.println("</body></html>");

     return;
  }
  DiskFileItemFactory factory = new DiskFileItemFactory();
  // maximum size that will be stored in memory
  factory.setSizeThreshold(maxMemSize);
  // Location to save data that is larger than maxMemSize.
  factory.setRepository(new File("c:\\temp"));

  // Create a new file upload handler
  ServletFileUpload upload = new ServletFileUpload(factory);
  // maximum file size to be uploaded.
  upload.setSizeMax( maxFileSize );
  try{
      // Parse the request to get file items.
      List fileItems = upload.parseRequest(request);
   
      // Process the uploaded file items
      Iterator i = fileItems.iterator();
      out.println("<html><head>");
      out.println("<title>Servlet upload</title>");
      out.println("</head><body>");

      while ( i.hasNext () )
      {
         FileItem fi = (FileItem)i.next();
         if ( !fi.isFormField () )   
         {
            // Get the uploaded file parameters
            String fieldName = fi.getFieldName();
            String fileName = fi.getName();
            String contentType = fi.getContentType();
            boolean isInMemory = fi.isInMemory();
            long sizeInBytes = fi.getSize();
            // Write the file
            if( fileName.lastIndexOf("\\") >= 0 ){
               file = new File( filePath +
               fileName.substring( fileName.lastIndexOf("\\"))) ;
            }else{
               file = new File( filePath +
               fileName.substring(fileName.lastIndexOf("\\")+1)) ;
            }
            fi.write( file ) ;
            out.println("Uploaded File: " + fileName + "<br>");
         }
      }
      out.println("</body>");
      out.println("</html>");
   } catch(Exception ex) { System.out.println(ex);  }
   }
}


Output

Upload.html
Upload Servlet

0 comments :

Kill process running on certain port in windows



"Starting of Tomcat failed, the server port 8080 is already in" or
"other process that is running on port 8080" or
"Port 8080 already in use"

Many new developers facing this error while they try to run a program on a local server.  this error occur because another instance is listening to same port but many users don’t know what is the process, and how to stop it from the Services manger in Windows.
here is a small tutorial to free up the particular port immediately.

we use following two DOS commands:-
1) Netstat
Displays protocol statistics and current TCP/IP network connections.
2) Taskkill
This command line tool can be used to end one or more processes. Processes can be killed by the process id or image name.

we use following code :-
C:\WINDOWS\system32>netstat -o -n -a | findstr 8080
  TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       4184


C:\WINDOWS\system32> taskkill /F /PID 4184
SUCCESS: Sent termination signal to the process with PID 4184.



Or We can kill any process from task manager also

Steps are as follows:
1)    Open Task manager
Press ALT + CTRL + DELETE
2)    Open “Processes” tab
3)    Click on “ View-> Select Columns ” Menu
4)    Click  check box  “PID- Process Identifier
this will show Process ID column which helps us in identifying running process
5)    Now Right Click on particular process
n click on End Process
Note:- Never kill system processes otherwise it results in immediate shutdown of windows.

To find more details about these commands use dos help utility “ /?”
Netstat /? Or Taskkill /?

Note:-  Sometimes we face error as
“  'netstat' is not recognized as an internal or external command, operable program or batch file.”
to use netstat command we have to relocate promt to “c:\windows\system32” folder
use following command

c:\> cd c:\windows\system32

3 comments :

Send email in servlet using gmail


To send an email using your a Servlet is simple enough but to start with you should have JavaMail API and Java Activation Framework (JAF) installed on your machine.
You need to add mail.jar and activation.jar files in your CLASSPATH.

Sending email

 We use the Java Mail API. In order to succeed sending an email, we must have a gmail account. We use the Google's smtp server to forward the email. So in the form, we must provide the login and the password of our gmail account. The example consists of five files. A css style file provides the look and feel for our jsp pages. The mail.html is used to fill in the form and send the data to the servlet. The EmailServlet processes the data and tries to send the email to the recipient. If it succeeds, the servlet forwards to the success.jsp file. If not, we receive an error message in error.jsp file.

style.css

body { width:1000px; border:0px; margin:0px auto; padding:0px; }
wrapper { margin:auto; width:1000px; }

.button { text-decoration:none; padding:8px; font:bold 12px Georgia,serif; color:white; 
background-color:rgb(0,130,130); border-color:rgb(0,130,130); }
.button:hover { text-decoration:none; padding:8px; font:bold 12px Georgia,serif; color:rgb(0,130,130);
background-color:white; border-color:rgb(0,130,130); }

fieldset { border-color:rgb(0,130,130); }
input:focus { background-color:yellow; }

mail.html

<html><head>
<title>Sending email</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head><body>

<div class="wrapper">
<fieldset style="padding:0px 10px 10px 10px; ">
<legend> Mail System </legend>

<form action="EmailServlet" method="post">  
<table> <tr> <td>From</td>
<td><input type="text" name="from"  size="60"></td>
</tr> <tr>
<td>To</td>
<td><input type="text" name="to"  size="60"></td>
</tr> <tr>
<td>Subject</td>
<td><input type="text" name="subject"  size="60"></td>
</tr> <tr>
<td>Message</td>
<td><textarea rows="10" cols="70" name="message"></textarea></td>
</tr> <tr>
<td>Login</td>
<td><input type="text" name="login" size="60"></td>
</tr> <tr>
<td>Password</td>
<td><input type="password" name="password" size="60"></td>
</tr> <tr>
<td><input type="submit" value="SUBMIT" class="button"></td>
<td><input type="reset" value="RESET" class="button"></td>
</tr> </table>
</form> </fieldset> </div>
</body> </html>

EmailServlet.java

import java.io.*;
import java.net.*;
import java.util.Properties;
import javax.mail.AuthenticationFailedException;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.servlet.*;
import javax.servlet.http.*;

public class EmailServlet extends HttpServlet {

    protected void processRequest(HttpServletRequest request,
                                  HttpServletResponse response)
                   throws IOException, ServletException {
        final String err = "/error.jsp";
        final String succ = "/success.jsp";
        String from = request.getParameter("from");
        String to = request.getParameter("to");
        String subject = request.getParameter("subject");
        String message = request.getParameter("message");
        String login = request.getParameter("login");
        String password = request.getParameter("password");

        try {
            Properties props = new Properties();
            props.setProperty("mail.host", "smtp.gmail.com");
            props.setProperty("mail.smtp.port", "587");
            props.setProperty("mail.smtp.auth", "true");
            props.setProperty("mail.smtp.starttls.enable", "true");
            Authenticator auth = new SMTPAuthenticator(login, password);
            Session session = Session.getInstance(props, auth);
            MimeMessage msg = new MimeMessage(session);
            msg.setText(message);
            msg.setSubject(subject);
            msg.setFrom(new InternetAddress(from));
            msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
            Transport.send(msg);
        } 

            catch (AuthenticationFailedException ex) {
            request.setAttribute("ErrorMessage", "Authentication failed");
            RequestDispatcher dispatcher = request.getRequestDispatcher(err);
            dispatcher.forward(request, response);
        } 

            catch (AddressException ex) {
            request.setAttribute("ErrorMessage", "Wrong email address");
            RequestDispatcher dispatcher = request.getRequestDispatcher(err);
            dispatcher.forward(request, response);
        } 

            catch (MessagingException ex) {
            request.setAttribute("ErrorMessage", ex.getMessage());
            RequestDispatcher dispatcher = request.getRequestDispatcher(err);
            dispatcher.forward(request, response);
        }
            RequestDispatcher dispatcher = request.getRequestDispatcher(succ);
            dispatcher.forward(request, response);
    }
    private class SMTPAuthenticator extends Authenticator {
        private PasswordAuthentication authentication;
        public SMTPAuthenticator(String login, String password) {
            authentication = new PasswordAuthentication(login, password);
        }
        protected PasswordAuthentication getPasswordAuthentication() {
            return authentication;
        }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
        processRequest(request, response);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
        processRequest(request, response);
    }
}  


Error.jsp

<html> <head>
<title>Error</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body> <center>
<div class="error">
<h2>Error</h2>
<p>Message: <%= request.getAttribute("ErrorMessage") %></p>
</div></center>
</body></html>

Success.jsp

<html><head>
<title>Message</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>  <body>
<center>
<div class="msg">
<h2>Message</h2>
<p> Email sent </p>
</div>    </center>
</body> </html>


Enjoy...............

0 comments :

GET HOST NAME & IP IN ORACLE 10G

Use the Oracle 10g utility “UTL_INADDR” to get the Local Host Name and IP of the machine your Oracle 10g is running on. You can do this by executing the following commands: 

BEGIN
DBMS_OUTPUT.PUT_LINE(UTL_INADDR.GET_HOST_NAME);
DBMS_OUTPUT.PUT_LINE(UTL_INADDR.GET_HOST_ADDRESS);
END;
/

Output :-

USER
192.168.1.16

PL/SQL procedure successfully completed.



Get current database name:-



for connected instance - 
SELECT ora_database_name FROM dual; 
OR
SELECT global_name FROM global_name;

OR
SELECT * FROM global_name;


Output :-

ORA_DATABASE_NAME
----------------------------------------------------------------
ORCL.REGRESS.RDBMS.DEV.US.ORACLE.COM


or
Get User name, Databse name, Terminal name and Session ID:-

select 'User: '|| user || ' on database ' || global_name, ' (term='||USERENV('TERMINAL')|| ', audsid='||USERENV('SESSIONID')||')' as MYCONTEXT from global_name;

thnks....

0 comments :